import * as THREE from "three";
import { OrbitControls } from "three/addons/controls/OrbitControls.js";
import { DRACOLoader } from "three/addons/loaders/DRACOLoader.js";
import { GLTFLoader } from "three/addons/loaders/GLTFLoader.js";
// import * as TWEEN from "/assets/tweenjs.min.js"
console.log(THREE);
(function () {
  console.log("炉膛温度场文件");
  let runState = 0;
  //创建一个三维场景
  document.getElementById("todayTimer").innerHTML = moment(new Date()).format(
    "YYYY-MM-DD HH:mm:ss"
  );
  const devicePixelRatio = window.devicePixelRatio; //设备分辨率
  // 请求接口的
  function Request(baseUrl = "", time = 1000) {
    this.baseUrl = baseUrl;

    function request(url, option = {}) {
      return new Promise(async (resolve, reject) => {
        try {
          const response = await fetch(baseUrl + url, option);
          if (response.status == "200") {
            const data = await response.json();
            if (data.code == "200") {
              resolve(data);
            } else {
              reject(data.message || "请求失败");
            }
          } else {
            reject(response);
          }
        } catch (e) {
          reject(e);
        }
      });
    }

    this.post = function (url, data) {
      return request(url, {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
        },
        body: JSON.stringify(data),
      });
    };

    this.get = function (url) {
      return request(url, {
        method: "GET",
      });
    };
  }

  let runcaizhi = "";
  let stopcaizhi = "";
  Request.createRequest = function (baseUrl) {
    return new Request(baseUrl);
  };
  const request = Request.createRequest(now_open_diag.API_URL);

  function init() {
    let scene, light, spotLight, renderer, controls, camera, mesh;
    let krq1 = new THREE.Object3D(); //初始化一个空容器，装载粒子
    let krq2 = new THREE.Object3D();
    let krq3 = new THREE.Object3D();
    let krq4 = new THREE.Object3D();
    let krq5 = new THREE.Object3D();
    let krq6 = new THREE.Object3D();
    let krq7 = new THREE.Object3D();
    let krq8 = new THREE.Object3D();
    let krq9 = new THREE.Object3D();
    let krq10 = new THREE.Object3D();
    let krq11 = new THREE.Object3D();
    let krq12 = new THREE.Object3D();
    let krq13 = new THREE.Object3D();
    let krq14 = new THREE.Object3D();
    let krq15 = new THREE.Object3D();
    let krq16 = new THREE.Object3D();
    let krq17 = new THREE.Object3D();
    let krq18 = new THREE.Object3D();
    let krq19 = new THREE.Object3D();
    let krq20 = new THREE.Object3D();
    let krq21 = new THREE.Object3D();
    let krq22 = new THREE.Object3D();
    let krq23 = new THREE.Object3D();
    let krq24 = new THREE.Object3D();
    let krq25 = new THREE.Object3D();
    let krq26 = new THREE.Object3D();
    let krq27 = new THREE.Object3D();
    let krq28 = new THREE.Object3D();
  }

  //初始化场景元素
  const initCanvas = () => {
    initSgcene();
    initLiht();
    initCamera();
    //initASphere()
    initSceneItems();
    initARenderer();
    initAControls();
  };

  const vertexShader = `
    varying vec2 vUv;
    void main() {
      vUv = uv;
      gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
    }
    `;

  const fragmentShader = `
            uniform float time;
            varying vec2 vUv;
            void main() {
              vec3 color = vec3(1.0, 0.5, 0.0); // 火焰颜色
               gl_FragColor = vec4(color,1.0);
            }
            `;
  const material = new THREE.ShaderMaterial({
    uniforms: {
      time: { value: 0 },
    },
    vertexShader,
    fragmentShader,
  });
  let touming = "";
  const initScene = () => {
    scene = new THREE.Scene();
    // 场景设置
    //scene.background = new THREE.Color('#03244a')
    //在代码上面声明场景等下面加这句:
    scene.fog = new THREE.Fog("#333", 120, 150);
    //创建辅助坐标轴
    // const axesHelper = new THREE.AxesHelper(100)
    // scene.add(axesHelper)
    //加个地板 投射影子
    // let floorGeometry = new THREE.PlaneGeometry(50, 50,32, 32) //形状
    // let floorMaterial =new THREE.MeshStandardMaterial( {color: 0x03244a} );//材质
    // let floor = new THREE.Mesh(floorGeometry, floorMaterial)
    // floor.rotation.x = -0.5 * Math.PI
    // floor.receiveShadow = true
    // floor.position.y = -0.001
    // scene.add(floor)
  };

  //创建灯光
  const initLight = () => {
    // const ambient = new THREE.HemisphereLight( 0xffffff, 0x444444, 0.05 );
    light = new THREE.AmbientLight(0xffffff, 0.5); // soft white light
    scene.add(light);
    // 聚光灯
    spotLight = new THREE.SpotLight(0xffffff, 5);
    spotLight.position.set(25, 150, 75);
    spotLight.angle = Math.PI / 6;
    spotLight.penumbra = 1;
    spotLight.decay = 2;
    spotLight.distance = 300;
    // spotLight.map = textures[ 'disturb.jpg' ];
    spotLight.castShadow = true; //可以产生阴影
    spotLight.shadow.mapSize.width = 2048;
    spotLight.shadow.mapSize.height = 2048;
    spotLight.shadow.camera.near = 10;
    spotLight.shadow.camera.far = 200;
    spotLight.shadow.focus = 1;
    scene.add(spotLight);
  };

  //创建相机
  const initCamera = () => {
    //创建一个透视相机
    const width = document.getElementById("three").offsetWidth;
    const height = document.getElementById("three").offsetHeight;
    // console.log(width);
    camera = new THREE.PerspectiveCamera(80, width / height, 1, 3000);
    //设置相机位置
    //x 轴红色  y绿色  z  蓝色
    camera.position.set(0, 0, 14);
    // camera.position.set(200, 200, 200);
    // camera.layers.disableAll();
    // camera.layers.enableAll();
    // camera.layers.disable( 1);
    // camera.layers.enable( 1);
    //设置相机方向
    // camera.lookAt(0,-5,0)
    //创建助手
    // const helper = new THREE.CameraHelper( spotLight.shadow.camera );
    // scene.add( helper );
  };

  //创建场景元素
  const initSceneItems = () => {
    sessionStorage.setItem("glnumber", 4);
    const gltfLoader2 = new GLTFLoader();
    var dracoLoader = new DRACOLoader();
    // dracoLoader.setDecoderPath( '/js/draco/' );
    dracoLoader.setDecoderPath("/examples/js/libs/draco/");
    // 定义着色器代码
    // float noise = abs(fract(sin(dot(gl_FragCoord.xyz + time, vec3(12.9898, 78.233, 45.5432))) * 42758.5453));
    // gl_FragColor = vec4(color * noise, 1.0);

    // 创建材质
    gltfLoader2.setDRACOLoader(dracoLoader);
    const url2 = "./guolu.glb";
    gltfLoader2.load(
      url2,
      (gltf) => {
        const root = gltf.scene;
        console.log(root.children);
        // 给每个mesh 添加阴影
        root.traverse(function (node) {
          if (node instanceof THREE.Mesh) {
            node.castShadow = true;
          }
        });
        mesh = root;
        //纹理贴图加载器TextureLoader
        // .load()方法加载图像，返回一个纹理对象Texture
        runcaizhi = material;
        stopcaizhi = mesh.children[7].material;
        // mesh.children[4].material.map=texture
        // mesh.children[4].material.opacity = 0.4
        // mesh.children[4].material.transparent = true
        // mesh.children[5].material.transparent = true
        // mesh.children[0].material.transparent = true
        // mesh.children[3].material.transparent = true
        // mesh.children[1].material.transparent = true
        // mesh.children[2].material.transparent = true
        touming = mesh.children[9].material;
        mesh.children[8].material.opacity = 0.3;
        mesh.children[9].material.opacity = mesh.children[8].material.opacity;
        // mesh.children[23].visible = false
        // mesh.children[0].position.y = -2
        // mesh.children[9].position.y = -1.2
        // mesh.children[16].position.y = -1.2
        // mesh.children[23].position.y = -1.2
        // mesh.children[1].material.opacity = 0.3
        // 6-11 为 soft E D C B A
        // mesh.children[5].geometry =
        // mesh.children[6].material = materiali
        mesh.children[8].material = material;
        // mesh.children[8].visible = false
        // mesh.children[9].material = materiali
        // mesh.children[10].material = materiali
        // mesh.children[11].material = materiali
        // mesh.children[12].material = materiali
        // mesh.children[13].material = materiali
        // mesh.children[18].visible = false
        mesh.position.y = -8;
        mesh.position.x = 0;
        mesh.position.z = 0;
        mesh.rotation.y = 0;
        mesh.castShadow = true; //有阴影
        mesh.scale.set(3, 1.73, 3);
        // A层定位
        // mesh.children[32].position.y = mesh.children[32].position.y - 0.1
        // mesh.children[24].position.y = mesh.children[24].position.y - 0.1
        // mesh.children[16].position.y = mesh.children[16].position.y - 0.1
        // mesh.children[6].position.y = mesh.children[6].position.y - 0.1
        // b层定位
        // mesh.children[5].position.y = mesh.children[5].position.y - 0.2
        // mesh.children[15].position.y = mesh.children[15].position.y - 0.2
        // mesh.children[23].position.y = mesh.children[23].position.y - 0.2
        // mesh.children[31].position.y = mesh.children[31].position.y - 0.2
        // c层定位
        // mesh.children[4].position.y = mesh.children[4].position.y - 0.3
        // mesh.children[14].position.y = mesh.children[14].position.y - 0.3
        // mesh.children[22].position.y = mesh.children[22].position.y - 0.3
        // mesh.children[30].position.y = mesh.children[30].position.y - 0.3
        // d层定位
        // mesh.children[3].position.y = mesh.children[3].position.y + 0.1
        // mesh.children[13].position.y = mesh.children[13].position.y + 0.1
        // mesh.children[21].position.y = mesh.children[21].position.y + 0.1
        // mesh.children[29].position.y = mesh.children[29].position.y + 0.1
        // e层定位
        // mesh.children[2].position.y = mesh.children[2].position.y + 0.2
        // mesh.children[12].position.y = mesh.children[12].position.y + 0.2
        // mesh.children[20].position.y = mesh.children[20].position.y + 0.2
        // mesh.children[28].position.y = mesh.children[28].position.y + 0.2
        // f层定位
        // mesh.children[1].position.y = mesh.children[1].position.y + 0.3
        // mesh.children[11].position.y = mesh.children[11].position.y + 0.3
        // mesh.children[19].position.y = mesh.children[19].position.y + 0.3
        // mesh.children[27].position.y = mesh.children[27].position.y + 0.3
        // g层定位
        // mesh.children[7].position.y = mesh.children[7].position.y + 0.4
        // mesh.children[17].position.y = mesh.children[17].position.y + 0.4
        // mesh.children[25].position.y = mesh.children[25].position.y + 0.4
        // mesh.children[33].position.y = mesh.children[33].position.y + 0.4
        // sofa层定位
        // mesh.children[0].position.y = mesh.children[0].position.y + 0.5
        // mesh.children[10].position.y = mesh.children[10].position.y + 0.5
        // mesh.children[18].position.y = mesh.children[18].position.y + 0.5
        // mesh.children[26].position.y = mesh.children[26].position.y + 0.5
        console.log(mesh.children[7].material);
        scene.add(mesh);
        // function animate() {
        //     requestAnimationFrame(animate);
        //     material.uniforms.time.value += 0.1;
        //     renderer.render(scene, camera);
        // }
        // animate();

        // initFireSpite()
        initFlame();
        // for (let j = 3; j < mesh.parent.children.length; j++) {
        //     mesh.parent.children[j].visible = false
        // }
      }
      // 加载过程回调函数onProgress：加载过程不停地重复执行该函数中代码
      // function (xhr) {
      // 控制台查看加载进度xhr
      // 通过加载进度xhr可以控制前端进度条进度   Math.floor:小数加载进度取整
      //console.log('加载进度' + Math.floor(xhr.loaded / xhr.total * 100) + '%');
      // },
      // 加载错误回调函数onError
      // function (err) {
      //     console.error('加载发生错误');
      // }
    );
  };

  // 创建精灵 火焰效果
  const initFireSpite = () => {
    var map = new THREE.TextureLoader().load("./assets/flamex.png");
    var material = new THREE.SpriteMaterial({
      map: map,
      color: 0xffffff,
      fog: true,
    });

    var sprite = new THREE.Sprite(material);
    sprite.position.y = -3;
    sprite.position.x = -0.5;
    sprite.rotation.x = 180;

    scene.add(sprite);
  };

  function initFlame() {
    var texture = new THREE.TextureLoader().load("./assets/flamex.png");
    // var texture1 = new THREE.TextureLoader().load("./assets/flamex1.png");
    // var texture2 = new THREE.TextureLoader().load("./assets/flamex2.png");
    //sprite材质
    var material = new THREE.SpriteMaterial({
      //以canvas作为纹理
      map: texture,
      //混合度 减法混合
      blending: THREE.AdditiveBlending,
      color: 0xffffff,
      fog: true,
    });

    // var material1 = new THREE.SpriteMaterial({
    //     //以canvas作为纹理
    //     map: texture1,
    //     //混合度 加法混合
    //     blending: THREE.AdditiveBlending
    // });var material2 = new THREE.SpriteMaterial({
    //     //以canvas作为纹理
    //     map: texture2,
    //     //混合度 加法混合
    //     blending: THREE.AdditiveBlending
    // });
    //循环1000  添加粒子
    for (var i = 0; i < 800; i++) {
      var particle = new THREE.Sprite(material);
      var particle1 = new THREE.Sprite(material);
      var particle2 = new THREE.Sprite(material);
      var particle3 = new THREE.Sprite(material);

      var particle4 = new THREE.Sprite(material);
      var particle5 = new THREE.Sprite(material);
      var particle6 = new THREE.Sprite(material);
      var particle7 = new THREE.Sprite(material);

      var particle8 = new THREE.Sprite(material);
      var particle9 = new THREE.Sprite(material);
      var particle10 = new THREE.Sprite(material);
      var particle11 = new THREE.Sprite(material);

      var particle12 = new THREE.Sprite(material);
      var particle13 = new THREE.Sprite(material);
      var particle14 = new THREE.Sprite(material);
      var particle15 = new THREE.Sprite(material);

      var particle16 = new THREE.Sprite(material);
      var particle17 = new THREE.Sprite(material);
      var particle18 = new THREE.Sprite(material);
      var particle19 = new THREE.Sprite(material);

      var particle20 = new THREE.Sprite(material);
      var particle21 = new THREE.Sprite(material);
      var particle22 = new THREE.Sprite(material);
      var particle23 = new THREE.Sprite(material);

      var particle24 = new THREE.Sprite(material);
      var particle25 = new THREE.Sprite(material);
      var particle26 = new THREE.Sprite(material);
      var particle27 = new THREE.Sprite(material);

      initParticle(particle, i);
      initParticle(particle1, i);
      initParticle(particle2, i);
      initParticle(particle3, i);

      initParticle(particle4, i);
      initParticle(particle5, i);
      initParticle(particle6, i);
      initParticle(particle7, i);

      initParticle(particle8, i);
      initParticle(particle9, i);
      initParticle(particle10, i);
      initParticle(particle11, i);

      initParticle(particle12, i);
      initParticle(particle13, i);
      initParticle(particle14, i);
      initParticle(particle15, i);

      initParticle(particle16, i);
      initParticle(particle17, i);
      initParticle(particle18, i);
      initParticle(particle19, i);

      initParticle(particle20, i);
      initParticle(particle21, i);
      initParticle(particle22, i);
      initParticle(particle23, i);

      initParticle(particle24, i);
      initParticle(particle25, i);
      initParticle(particle26, i);
      initParticle(particle27, i);

      krq4.add(particle);
      krq4.name = "particles_flame";
      krq2.add(particle1);
      krq2.name = "particles_flame1";
      krq3.add(particle2);
      krq3.name = "particles_flame2";
      krq1.add(particle3);
      krq1.name = "particles_flame3";

      krq5.add(particle7);
      krq5.name = "particles_flame4";
      krq6.add(particle5);
      krq6.name = "particles_flame5";
      krq7.add(particle6);
      krq7.name = "particles_flame6";
      krq8.add(particle4);
      krq8.name = "particles_flame7";

      krq9.add(particle11);
      krq9.name = "particles_flame8";
      krq10.add(particle9);
      krq10.name = "particles_flame9";
      krq11.add(particle10);
      krq11.name = "particles_flame10";
      krq12.add(particle8);
      krq12.name = "particles_flame11";

      krq13.add(particle15);
      krq13.name = "particles_flame12";
      krq14.add(particle13);
      krq14.name = "particles_flame13";
      krq15.add(particle14);
      krq15.name = "particles_flame14";
      krq16.add(particle12);
      krq16.name = "particles_flame15";

      krq17.add(particle16);
      krq17.name = "particles_flame16";
      krq18.add(particle17);
      krq18.name = "particles_flame17";
      krq19.add(particle18);
      krq19.name = "particles_flame18";
      krq20.add(particle19);
      krq20.name = "particles_flame19";

      krq21.add(particle20);
      krq21.name = "particles_flame20";
      krq22.add(particle21);
      krq22.name = "particles_flame21";
      krq23.add(particle22);
      krq23.name = "particles_flame22";
      krq24.add(particle23);
      krq24.name = "particles_flame23";

      krq25.add(particle24);
      krq25.name = "particles_flame24";
      krq26.add(particle25);
      krq26.name = "particles_flame25";
      krq27.add(particle26);
      krq27.name = "particles_flame26";
      krq28.add(particle27);
      krq28.name = "particles_flame27";
    }
    // krq.position.set(1, -3.6, -1);
    // A层火焰
    krq3.position.set(1.1, -13.4, -1.1);
    krq3.rotation.set(0, 1, 1);
    krq3.scale.set(0.7, 0.25, 0.5);
    krq3.scale.multiplyScalar(1.7);
    // 2
    krq2.position.set(-1.3, -13.4, -1.1);
    krq2.rotation.set(0, -4, 1);
    krq2.scale.set(0.7, 0.25, 0.5);
    krq2.scale.multiplyScalar(1.7);
    // 3
    krq1.position.set(-1.3, -13.4, 2);
    krq1.rotation.set(0, 3.75, 1);
    krq1.scale.set(0.7, 0.25, 0.5);
    krq1.scale.multiplyScalar(1.7);
    // 4
    krq4.position.set(1.6, -13.4, 2);
    krq4.rotation.set(0, -0.8, 1);
    krq4.scale.set(0.7, 0.25, 0.5);
    krq4.scale.multiplyScalar(1.7);

    // // B层火焰5
    krq7.position.set(1.1, -12.7, -1.1);
    krq7.rotation.set(0, 0.3, 1);
    krq7.scale.set(0.7, 0.25, 0.5);
    krq7.scale.multiplyScalar(1.7);
    // 6
    krq6.position.set(-1.3, -12.7, -1.1);
    krq6.rotation.set(0, -4, 1);
    krq6.scale.set(0.7, 0.25, 0.5);
    krq6.scale.multiplyScalar(1.7);
    // 7
    krq5.position.set(-1.3, -12.7, 2);
    krq5.rotation.set(0, 3.75, 1);
    krq5.scale.set(0.7, 0.25, 0.5);
    krq5.scale.multiplyScalar(1.7);
    // 8
    krq8.position.set(1.6, -12.7, 2);
    krq8.rotation.set(0, -0.8, 1);
    krq8.scale.set(0.7, 0.25, 0.5);
    krq8.scale.multiplyScalar(1.7);
    // c层火焰9
    krq11.position.set(1.1, -12, -1.1);
    krq11.rotation.set(0, 0.3, 1);
    krq11.scale.set(0.7, 0.25, 0.5);
    krq11.scale.multiplyScalar(1.7);
    // 10
    krq10.position.set(-1.3, -12, -1.1);
    krq10.rotation.set(0, -4, 1);
    krq10.scale.set(0.7, 0.25, 0.5);
    krq10.scale.multiplyScalar(1.7);
    // 11
    krq9.position.set(-1.3, -12, 2);
    krq9.rotation.set(0, 3.75, 1);
    krq9.scale.set(0.7, 0.25, 0.5);
    krq9.scale.multiplyScalar(1.7);
    // 12
    krq12.position.set(1.6, -12, 2);
    krq12.rotation.set(0, -0.8, 1);
    krq12.scale.set(0.7, 0.25, 0.5);
    krq12.scale.multiplyScalar(1.7);
    // // D层火焰 13
    krq15.position.set(1.1, -11.5, -1.1);
    krq15.rotation.set(0, 0.3, 1);
    krq15.scale.set(0.7, 0.25, 0.5);
    krq15.scale.multiplyScalar(1.7);
    // 14
    krq14.position.set(-1.3, -11.5, -1.1);
    krq14.rotation.set(0, -4, 1);
    krq14.scale.set(0.7, 0.25, 0.5);
    krq14.scale.multiplyScalar(1.7);
    // 15
    krq13.position.set(-1.3, -11.5, 2);
    krq13.rotation.set(0, 3.75, 1);
    krq13.scale.set(0.7, 0.25, 0.5);
    krq13.scale.multiplyScalar(1.7);
    // 16
    krq16.position.set(1.6, -11.5, 2);
    krq16.rotation.set(0, -0.8, 1);
    krq16.scale.set(0.7, 0.25, 0.5);
    krq16.scale.multiplyScalar(1.7);
    // E层火焰17
    krq17.position.set(1.1, -10.8, -1.1);
    krq17.rotation.set(0, 0.3, 1);
    krq17.scale.set(0.7, 0.25, 0.5);
    krq17.scale.multiplyScalar(1.7);
    // 18
    krq18.position.set(-1.3, -10.8, -1.1);
    krq18.rotation.set(0, -4, 1);
    krq18.scale.set(0.7, 0.25, 0.5);
    krq18.scale.multiplyScalar(1.7);
    // 19
    krq19.position.set(-1.3, -10.8, 2);
    krq19.rotation.set(0, 3.75, 1);
    krq19.scale.set(0.7, 0.25, 0.5);
    krq19.scale.multiplyScalar(1.7);
    // 20
    krq20.position.set(1.6, -10.8, 2);
    krq20.rotation.set(0, -0.8, 1);
    krq20.scale.set(0.7, 0.25, 0.5);
    krq20.scale.multiplyScalar(1.7);
    // F层火焰21
    krq21.position.set(1.1, -10.1, -1.1);
    krq21.rotation.set(0, 0.3, 1);
    krq21.scale.set(0.7, 0.25, 0.5);
    krq21.scale.multiplyScalar(1.7);
    // 22
    krq22.position.set(-1.3, -10.1, -1.1);
    krq22.rotation.set(0, -4, 1);
    krq22.scale.set(0.7, 0.25, 0.5);
    krq22.scale.multiplyScalar(1.7);
    // 23
    krq23.position.set(-1.3, -10.1, 2);
    krq23.rotation.set(0, 3.75, 1);
    krq23.scale.set(0.7, 0.25, 0.5);
    krq23.scale.multiplyScalar(1.7);
    // // 24
    krq24.position.set(1.6, -10.1, 2);
    krq24.rotation.set(0, -0.8, 1);
    krq24.scale.set(0.7, 0.25, 0.5);
    krq24.scale.multiplyScalar(1.7);
    // G层火焰21
    krq25.position.set(1.1, -9.4, -1.1);
    krq25.rotation.set(0, 0.3, 1);
    krq25.scale.set(0.7, 0.25, 0.5);
    krq25.scale.multiplyScalar(1.7);
    // 22
    krq26.position.set(-1.3, -9.4, -1.1);
    krq26.rotation.set(0, -4, 1);
    krq26.scale.set(0.7, 0.25, 0.5);
    krq26.scale.multiplyScalar(1.7);
    // 23
    krq27.position.set(-1.3, -9.4, 2);
    krq27.rotation.set(0, 3.75, 1);
    krq27.scale.set(0.7, 0.25, 0.5);
    krq27.scale.multiplyScalar(1.7);
    // // 24
    krq28.position.set(1.6, -9.4, 2);
    krq28.rotation.set(0, -0.8, 1);
    krq28.scale.set(0.7, 0.25, 0.5);
    krq28.scale.multiplyScalar(1.7);

    scene.add(krq1, krq2, krq3, krq4);
    scene.add(krq5, krq6, krq7, krq8);
    scene.add(krq9, krq10, krq11, krq12);
    scene.add(krq13, krq14, krq15, krq16);
    scene.add(krq17, krq18, krq19, krq20);
    scene.add(krq21, krq22, krq23, krq24);
    scene.add(krq25, krq26, krq27, krq28);
  }

  /**
   * 粒子 延迟发散
   * @param particle
   * @param delay
   */
  function initParticle(particle, delay) {
    particle.position.set(5, Math.random() + 5, 0);
    particle.scale.x = particle.scale.y = Math.random() * 3;
    //下面是一系列的动画
    var xx = Math.random() * 10 - 5;
    var yy = Math.cos((Math.PI / 100) * xx) * 21;
    //位移
    // debugger
    new TWEEN.Tween(particle.position)
      .delay(delay)
      .to(
        {
          x: xx,
          y: yy,
          z: Math.random() * 10 - 5,
        },
        2000
      )
      .onComplete(function () {
        initParticle(particle, delay);
      })
      .start();
    // 大小
    new TWEEN.Tween(particle.scale)
      .delay(delay)
      .to(
        {
          x: 0.01,
          y: 0.01,
        },
        900
      )
      .start();
  }
  //创建渲染
  const initARenderer = () => {
    renderer = new THREE.WebGLRenderer({
      antialias: true,
      logarithmicDepthBuffer: true,
      alpha: true,
    });
    // renderer.setPixelRatio (devicePixelRatio)
    renderer.setPixelRatio(window.devicePixelRatio);
    // console.log(document.getElementById('three').offsetWidth);
    renderer.setSize(
      document.getElementById("three").offsetWidth,
      document.getElementById("three").offsetHeight
    );
    renderer.shadowMap.enabled = true;
    renderer.shadowMap.type = THREE.PCFSoftShadowMap;
    // renderer.outputEncoding = THREE.sRGBEncoding;
  };

  const render = () => {
    renderer.render(scene, camera);

    // labelRenderer.render( scene, camera )
    controls.update();
    TWEEN.update();
    requestAnimationFrame(render);
  };

  window.addEventListener("resize", onWindowResize);

  function onWindowResize() {
    camera.aspect =
      document.getElementById("three").offsetWidth /
      document.getElementById("three").offsetHeight;
    camera.updateProjectionMatrix();
    renderer.setSize(
      document.getElementById("three").offsetWidth,
      document.getElementById("three").offsetHeight
    );
    // labelRenderer.setSize(document.getElementById('three').offsetWidth, document.getElementById('three').offsetHeight );
    // labelRenderer.render( scene, camera )
    // renderer.render(scene, camera)
  }
  //
  //创建相机控制器
  const initAControls = () => {
    // controls.enableDamping = true
    // 设置阻尼

    //controls = new TrackballControls(camera, document.querySelector('#three'));
    // controls.noZoom = true;
    //console.log(controls);
    //controls.noPan = true;
    // controls.handleResize();
    controls = new OrbitControls(camera, document.querySelector("#three"));
    //controls = new OrbitControls(camera, renderer.domElement)
    controls.update();
    controls.autoRotate = true;
    controls.autoRotateSpeed = 1;
    // controls.enableDamping = true;
    // controls.autoRotateSpeed = 1;
    // controls.enableRotate=false
    // controls.enablePan=false  //右键平移
    //
    // controls.maxAzimuthAngle=0
    // controls.minAzimuthAngle=0
    // controls.maxPolarAngle = 1
    // controls.minPolarAngle = 1
    controls.target.set(0, -2, 0);
    // controls.addEventListener('change',()=>{
    //   console.log('change');
    //   renderer.render(scene, camera)
    // // labelRenderer.render( scene, camera )
    //
    // })
  };

  initCanvas();
  // console.log(renderer.domElement);
  document.getElementById("three")?.appendChild(renderer.domElement);
  render();

  const initEvent = (str, isb) => {
    //获取事件元素
    let oFootBtns = document.getElementById(str).children; //底部菜单 btns
    if (str == "zbf_foot_btns") {
      now_open_diag.username == "admin"
        ? ""
        : (oFootBtns[oFootBtns.length - 1].style.display = "none");
      // now_open_diag.username == "admin" ? "" : oFootBtns[oFootBtns.length - 2].style.display = "none"
    }
    for (let i = 0; i < oFootBtns.length; i++) {
      oFootBtns[i].onclick = () => {
        if (isb) {
          for (let ii = 0; ii < oFootBtns.length; ii++) {
            oFootBtns[ii].className = "";
          }
          oFootBtns[i].className = "active";
        } else {
          if (i != 9) {
            oFootBtns[i].className =
              oFootBtns[i].className == "active" ? "" : "active";
          }
        }

        if (str == "zbf_r_btns") {
          if (i == 9) {
            for (let huo = 0; huo < scene.children.length; huo++) {
              if (huo >= 3) {
                scene.children[huo].visible = false;
              }
            }
            // A层
            console.log(scene);
            scene.children[2].children[6].visible = false;
            scene.children[2].children[16].visible = false;
            scene.children[2].children[24].visible = false;
            scene.children[2].children[32].visible = false;
            // B层
            scene.children[2].children[5].visible = false;
            scene.children[2].children[15].visible = false;
            scene.children[2].children[23].visible = false;
            scene.children[2].children[31].visible = false;
            // c层
            scene.children[2].children[4].visible = false;
            scene.children[2].children[14].visible = false;
            scene.children[2].children[22].visible = false;
            scene.children[2].children[30].visible = false;
            // 控制D层显隐藏
            scene.children[2].children[3].visible = false;
            scene.children[2].children[13].visible = false;
            scene.children[2].children[21].visible = false;
            scene.children[2].children[29].visible = false;
            // 控制E层显隐藏
            scene.children[2].children[2].visible = false;
            scene.children[2].children[12].visible = false;
            scene.children[2].children[20].visible = false;
            scene.children[2].children[28].visible = false;
            // 控制F层显隐藏
            scene.children[2].children[1].visible = false;
            scene.children[2].children[11].visible = false;
            scene.children[2].children[19].visible = false;
            scene.children[2].children[27].visible = false;
            // 控制G层显隐藏
            scene.children[2].children[7].visible = false;
            scene.children[2].children[17].visible = false;
            scene.children[2].children[25].visible = false;
            scene.children[2].children[33].visible = false;
            // 燃尽风
            scene.children[2].children[0].visible = false;
            scene.children[2].children[10].visible = false;
            scene.children[2].children[18].visible = false;
            scene.children[2].children[26].visible = false;

            for (let ii = 0; ii < oFootBtns.length; ii++) {
              oFootBtns[ii].className = "";
            }
          } else if (i == 0) {
            // 控制A层显隐藏
            scene.children[2].children[6].visible =
              !scene.children[2].children[6].visible;
            scene.children[2].children[16].visible =
              !scene.children[2].children[16].visible;
            scene.children[2].children[24].visible =
              !scene.children[2].children[24].visible;
            scene.children[2].children[32].visible =
              !scene.children[2].children[32].visible;
            // if (document.getElementById('zbf_r_btns').children[0].className == "") {
            //     scene.children[3].visible = true
            //     scene.children[4].visible = true
            //     scene.children[5].visible = true
            //     scene.children[6].visible = true
            // } else {
            //     if (rsqState[0] == 1) {
            //         scene.children[3].visible = false
            //         scene.children[4].visible = false
            //         scene.children[5].visible = false
            //         scene.children[6].visible = false
            //     } else {
            //         scene.children[3].visible = true
            //         scene.children[4].visible = true
            //         scene.children[5].visible = true
            //         scene.children[6].visible = true
            //     }
            // }
          } else if (i == 1) {
            // 控制B层显隐藏
            scene.children[2].children[5].visible =
              !scene.children[2].children[5].visible;
            scene.children[2].children[15].visible =
              !scene.children[2].children[15].visible;
            scene.children[2].children[23].visible =
              !scene.children[2].children[23].visible;
            scene.children[2].children[31].visible =
              !scene.children[2].children[31].visible;

            // if (document.getElementById('zbf_r_btns').children[1].className == "") {
            //     scene.children[7].visible = true
            //     scene.children[8].visible = true
            //     scene.children[9].visible = true
            //     scene.children[10].visible = true
            // } else {
            //     if (rsqState[1] == 1) {
            //         scene.children[7].visible = false
            //         scene.children[8].visible = false
            //         scene.children[9].visible = false
            //         scene.children[10].visible = false

            //     } else {
            //         scene.children[7].visible = true
            //         scene.children[8].visible = true
            //         scene.children[9].visible = true
            //         scene.children[10].visible = true
            //     }
            // }
          } else if (i == 2) {
            // 控制C层显隐藏
            scene.children[2].children[4].visible =
              !scene.children[2].children[4].visible;
            scene.children[2].children[14].visible =
              !scene.children[2].children[14].visible;
            scene.children[2].children[22].visible =
              !scene.children[2].children[22].visible;
            scene.children[2].children[30].visible =
              !scene.children[2].children[30].visible;
            // if (document.getElementById('zbf_r_btns').children[2].className == "") {
            //     scene.children[11].visible = false
            //     scene.children[12].visible = false
            //     scene.children[13].visible = false
            //     scene.children[14].visible = false
            // }
            // else {
            //     if (rsqState[2] == 1) {
            //         scene.children[11].visible = false
            //         scene.children[12].visible = false
            //         scene.children[13].visible = false
            //         scene.children[14].visible = false

            //     } else {
            //         scene.children[11].visible = true
            //         scene.children[12].visible = true
            //         scene.children[13].visible = true
            //         scene.children[14].visible = true
            //     }
            // }
          } else if (i == 3) {
            // 控制D层显隐藏
            scene.children[2].children[3].visible =
              !scene.children[2].children[3].visible;
            scene.children[2].children[13].visible =
              !scene.children[2].children[13].visible;
            scene.children[2].children[21].visible =
              !scene.children[2].children[21].visible;
            scene.children[2].children[29].visible =
              !scene.children[2].children[29].visible;
            // if (document.getElementById('zbf_r_btns').children[3].className == "") {
            //     scene.children[15].visible = false
            //     scene.children[16].visible = false
            //     scene.children[17].visible = false
            //     scene.children[18].visible = false
            // }
            // else {
            //     if (rsqState[3] == 1) {
            //         scene.children[15].visible = false
            //         scene.children[16].visible = false
            //         scene.children[17].visible = false
            //         scene.children[18].visible = false
            //     } else {
            //         scene.children[15].visible = true
            //         scene.children[16].visible = true
            //         scene.children[17].visible = true
            //         scene.children[18].visible = true
            //     }
            // }
          } else if (i == 4) {
            // 控制E层显隐藏
            scene.children[2].children[2].visible =
              !scene.children[2].children[2].visible;
            scene.children[2].children[12].visible =
              !scene.children[2].children[12].visible;
            scene.children[2].children[20].visible =
              !scene.children[2].children[20].visible;
            scene.children[2].children[28].visible =
              !scene.children[2].children[28].visible;
            // if (document.getElementById('zbf_r_btns').children[4].className == "") {
            //     scene.children[19].visible = false
            //     scene.children[20].visible = false
            //     scene.children[21].visible = false
            //     scene.children[22].visible = false
            // } else {
            //     if (rsqState[4] == 1) {
            //         scene.children[19].visible = false
            //         scene.children[20].visible = false
            //         scene.children[21].visible = false
            //         scene.children[22].visible = false
            //     } else {
            //         scene.children[19].visible = true
            //         scene.children[20].visible = true
            //         scene.children[21].visible = true
            //         scene.children[22].visible = true
            //     }
            // }
          } else if (i == 5) {
            // 控制F层显隐藏
            scene.children[2].children[1].visible =
              !scene.children[2].children[1].visible;
            scene.children[2].children[11].visible =
              !scene.children[2].children[11].visible;
            scene.children[2].children[19].visible =
              !scene.children[2].children[19].visible;
            scene.children[2].children[27].visible =
              !scene.children[2].children[27].visible;
            // if (document.getElementById('zbf_r_btns').children[5].className == "") {
            //     scene.children[23].visible = false
            //     scene.children[24].visible = false
            //     scene.children[25].visible = false
            //     scene.children[26].visible = false
            // } else {
            //     if (rsqState[5] == 1) {
            //         scene.children[23].visible = false
            //         scene.children[24].visible = false
            //         scene.children[25].visible = false
            //         scene.children[26].visible = false
            //     } else {
            //         scene.children[23].visible = true
            //         scene.children[24].visible = true
            //         scene.children[25].visible = true
            //         scene.children[26].visible = true
            //     }
            // }
          } else if (i == 6) {
            // 控制G层显隐藏
            scene.children[2].children[7].visible =
              !scene.children[2].children[7].visible;
            scene.children[2].children[17].visible =
              !scene.children[2].children[17].visible;
            scene.children[2].children[25].visible =
              !scene.children[2].children[25].visible;
            scene.children[2].children[33].visible =
              !scene.children[2].children[33].visible;
            // if (document.getElementById('zbf_r_btns').children[6].className == "") {
            //     scene.children[27].visible = false
            //     scene.children[28].visible = false
            //     scene.children[29].visible = false
            //     scene.children[30].visible = false
            // } else {
            //     if (rsqState[6] == 1) {
            //         scene.children[27].visible = false
            //         scene.children[28].visible = false
            //         scene.children[29].visible = false
            //         scene.children[30].visible = false
            //     } else {
            //         scene.children[27].visible = true
            //         scene.children[28].visible = true
            //         scene.children[29].visible = true
            //         scene.children[30].visible = true
            //     }
            // }
          } else if (i == 7) {
            // 控制SOFA层显隐藏
            scene.children[2].children[0].visible =
              !scene.children[2].children[0].visible;
            scene.children[2].children[10].visible =
              !scene.children[2].children[10].visible;
            scene.children[2].children[18].visible =
              !scene.children[2].children[18].visible;
            scene.children[2].children[26].visible =
              !scene.children[2].children[26].visible;

            // scene.children[2].children[23].visible = !scene.children[2].children[23].visible
          } else if (i == 8) {
            document
              .getElementById("zbf_r_btns")
              .addEventListener("click", function () {
                // const databox = []
                // request.get('/api/sjdl/home/dcs/zs').then(res => {
                //     // let res = {
                //     //     code: 200,
                //     //     data: {
                //     //         D1: 572.4484566697683,
                //     //         C1: 854.1832947776439,
                //     //         D2: 898.4317159396564,
                //     //         B1: 687.1815219576139,
                //     //         C2: 478.12991366890276,
                //     //         D3: 391.1707693675136,
                //     //         A1: 1,
                //     //         B2: 215.81176201718466,
                //     //         C3: 857.114027037535,
                //     //         D4: 888.1154598998936,
                //     //         A2: 1,
                //     //         B3: 450.2514783081176,
                //     //         C4: 231.766571615474,
                //     //         A3: 0,
                //     //         B4: 990.7000009157425,
                //     //         A4: 518.9111773994057
                //     //     },
                //     //     message: "获取数据成功"
                //     // }
                //     for (let k in res.data) { databox.push({ [k]: res.data[k] }) }
                //     databox.sort((a, b) => {
                //         let aKey = Object.keys(a)[0];
                //         let bKey = Object.keys(b)[0];
                //         if (aKey[0] === bKey[0]) {
                //             return aKey.slice(1) - bKey.slice(1);
                //         } else {
                //             return aKey[0].charCodeAt() - bKey[0].charCodeAt();
                //         }
                //     });
                //     // console.log(databox,scene.children)

                //     databox.forEach(obj => {
                //         let key = Object.keys(obj)[0];
                //         let value = obj[key].toFixed(2);
                //     })
                //     if (document.getElementById('zbf_r_btns').children[5].className == "") {
                //         for (let ahuo = 3; ahuo <= 18; ahuo++) {
                //             scene.children[ahuo].visible = false
                //         }
                //     } else {
                //         databox.forEach((obj, index) => {
                //             Object.keys(obj).forEach((key) => {
                //                 let value = obj[key];
                //                 if (value !== 0) {
                //                     scene.children[index + 3].visible = true
                //                 } else {
                //                     console.log(index + 3)
                //                     scene.children[index + 3].visible = false
                //                 }
                //             });
                //         });
                //     }
                // })

                request.post("/spf/visit/getThermalFieldAll").then((res) => {
                  rsqState[0] = res.data.runStateA;
                  rsqState[1] = res.data.runStateB;
                  rsqState[2] = res.data.runStateC;
                  rsqState[3] = res.data.runStateD;
                  rsqState[4] = res.data.runStateE;
                  rsqState[5] = res.data.runStateF;
                  rsqState[6] = res.data.runStateG;
                  if (
                    document.getElementById("zbf_r_btns").children[8]
                      .className == ""
                  ) {
                    for (let ahuo = 3; ahuo <= 30; ahuo++) {
                      scene.children[ahuo].visible = false;
                    }
                  } else {
                    if (
                      document.getElementById("zbf_r_btns").children[0]
                        .className == ""
                    ) {
                      scene.children[3].visible = false;
                      scene.children[4].visible = false;
                      scene.children[5].visible = false;
                      scene.children[6].visible = false;
                    } else {
                      if (rsqState[0] == 1) {
                        scene.children[3].visible = false;
                        scene.children[4].visible = false;
                        scene.children[5].visible = false;
                        scene.children[6].visible = false;
                      } else {
                        console.log("我实现了");
                        scene.children[3].visible = true;
                        scene.children[4].visible = true;
                        scene.children[5].visible = true;
                        scene.children[6].visible = true;
                      }
                    }
                    if (
                      document.getElementById("zbf_r_btns").children[1]
                        .className == ""
                    ) {
                      scene.children[7].visible = false;
                      scene.children[8].visible = false;
                      scene.children[9].visible = false;
                      scene.children[10].visible = false;
                    } else {
                      if (rsqState[1] == 1) {
                        scene.children[7].visible = false;
                        scene.children[8].visible = false;
                        scene.children[9].visible = false;
                        scene.children[10].visible = false;
                      } else {
                        scene.children[7].visible = true;
                        scene.children[8].visible = true;
                        scene.children[9].visible = true;
                        scene.children[10].visible = true;
                      }
                    }
                    if (
                      document.getElementById("zbf_r_btns").children[2]
                        .className == ""
                    ) {
                      scene.children[11].visible = false;
                      scene.children[12].visible = false;
                      scene.children[13].visible = false;
                      scene.children[14].visible = false;
                    } else {
                      if (rsqState[2] == 1) {
                        scene.children[11].visible = false;
                        scene.children[12].visible = false;
                        scene.children[13].visible = false;
                        scene.children[14].visible = false;
                      } else {
                        scene.children[11].visible = true;
                        scene.children[12].visible = true;
                        scene.children[13].visible = true;
                        scene.children[14].visible = true;
                      }
                    }
                    if (
                      document.getElementById("zbf_r_btns").children[3]
                        .className == ""
                    ) {
                      scene.children[15].visible = false;
                      scene.children[16].visible = false;
                      scene.children[17].visible = false;
                      scene.children[18].visible = false;
                    } else {
                      if (rsqState[3] == 1) {
                        scene.children[15].visible = false;
                        scene.children[16].visible = false;
                        scene.children[17].visible = false;
                        scene.children[18].visible = false;
                      } else {
                        scene.children[15].visible = true;
                        scene.children[16].visible = true;
                        scene.children[17].visible = true;
                        scene.children[18].visible = true;
                      }
                    }
                    if (
                      document.getElementById("zbf_r_btns").children[4]
                        .className == ""
                    ) {
                      scene.children[19].visible = false;
                      scene.children[20].visible = false;
                      scene.children[21].visible = false;
                      scene.children[22].visible = false;
                    } else {
                      if (rsqState[4] == 1) {
                        scene.children[19].visible = false;
                        scene.children[20].visible = false;
                        scene.children[21].visible = false;
                        scene.children[22].visible = false;
                      } else {
                        scene.children[19].visible = true;
                        scene.children[20].visible = true;
                        scene.children[21].visible = true;
                        scene.children[22].visible = true;
                      }
                    }
                    if (
                      document.getElementById("zbf_r_btns").children[5]
                        .className == ""
                    ) {
                      scene.children[23].visible = false;
                      scene.children[24].visible = false;
                      scene.children[25].visible = false;
                      scene.children[26].visible = false;
                    } else {
                      if (rsqState[5] == 1) {
                        scene.children[23].visible = false;
                        scene.children[24].visible = false;
                        scene.children[25].visible = false;
                        scene.children[26].visible = false;
                      } else {
                        scene.children[23].visible = true;
                        scene.children[24].visible = true;
                        scene.children[25].visible = true;
                        scene.children[26].visible = true;
                      }
                    }
                    if (
                      document.getElementById("zbf_r_btns").children[6]
                        .className == ""
                    ) {
                      scene.children[27].visible = false;
                      scene.children[28].visible = false;
                      scene.children[29].visible = false;
                      scene.children[30].visible = false;
                    } else {
                      if (rsqState[6] == 1) {
                        scene.children[27].visible = false;
                        scene.children[28].visible = false;
                        scene.children[29].visible = false;
                        scene.children[30].visible = false;
                      } else {
                        scene.children[27].visible = true;
                        scene.children[28].visible = true;
                        scene.children[29].visible = true;
                        scene.children[30].visible = true;
                      }
                    }
                  }
                });
              });
          }
        } else {
          const exit3D = () => {
            mesh.children.forEach((item) => {
              console.log(item.type);
              if (item.type == "Mesh") {
                item.geometry.dispose();
                item.material.map ? item.material.map.dispose() : "";
                item.material.dispose();
              }
            });
            scene.remove(mesh);
          };

          function closeDiag() {
            scene
              ? (exit3D(),
                (scene =
                  light =
                  spotLight =
                  renderer =
                  controls =
                  camera =
                    null))
              : "";
            // timer ? clearInterval(timer) : ""
            oTodayTimer ? clearInterval(oTodayTimer) : "";
            window.removeEventListener("resize", onWindowResize);
          }

          switch (i) {
            case 0:
              closeDiag();
              setTimeout(() => {
                window.location.href = "/index.html";
              }, 200);
              break;
            case 1:
              closeDiag();
              setTimeout(() => {
                // openFM("全炉膛温度场", 11, "SJDL_IFS_DATA.prj", "全炉膛温度场")
                window.location.href = "/ranshaoshuzihuajiance.html";
              }, 200);

              break;
            case 2:
              closeDiag();
              setTimeout(() => {
                // openFM("横截面", 6, "SJDL_IFS_DATA.prj", "横截面")
                window.location.href = "/hjm.html";
              }, 200);

              break;
            case 3:
              closeDiag();
              setTimeout(() => {
                // openFM("燃烧稳定性监测", 7, "SJDL_IFS_DATA.prj", "横截面云图")
                window.location.href = "/hjmwyt.html";
              }, 200);

              break;
            case 4:
              closeDiag();
              setTimeout(() => {
                // openFM("燃烧稳定性监测", 7, "SJDL_IFS_DATA.prj", "燃烧稳定性监测")
                window.location.href = "/ranshaowendingxing.html";
              }, 200);

              break;
            case 5:
              closeDiag();
              setTimeout(() => {
                // openFM("煤粉分配率", 9, "SJDL_IFS_DATA.prj", "煤粉分配率")
                window.location.href = "/meifen.html";
              }, 200);

              break;
            case 6:
              closeDiag();
              setTimeout(() => {
                // openFM("煤粉颗粒度分布", 8, "SJDL_IFS_DATA.prj", "煤粉颗粒度分布")
                window.location.href = "/main/dcimgs/gl/main.html";
              }, 200);

              break;
            case 7:
              closeDiag();
              setTimeout(() => {
                // openFM("预警信息", 12, "SJDL_IFS_DATA.prj", "预警信息")
                window.location.href = "/yujing.html";
              }, 200);

              break;
            case 8:
              closeDiag();
              setTimeout(() => {
                // openFM("历史数据", 10, "SJDL_IFS_DATA.prj", "历史数据")
                window.location.href = "/history.html";
              }, 200);

              break;
            case 9:
              closeDiag();
              setTimeout(() => {
                // openFM("预警阈值配置修改", 14, "SJDL_IFS_DATA.prj", "预警阈值配置修改")
                window.location.href = "/canshushezhi.html";
              }, 200);

              break;
            default:
          }
        }
      };
    }
  };

  initEvent("zbf_r_btns"); //横截面温度分布 btns
  initEvent("zbf_foot_btns", true); //底部菜单 btns
  let oRBtns = document.getElementById("zbf_r_btns").children; //底部菜单 btns
  let get3DFloorColorshishi = null;

  let rsqState = [0, 0, 0, 0, 0, 0, 0];
  const get3DFloorColor = () => {
    clearInterval(get3DFloorColorshishi);
    request.post("/spf/visit/getThermalFieldAll").then((res) => {
      rsqState[0] = res.data.runStateA;
      rsqState[1] = res.data.runStateB;
      rsqState[2] = res.data.runStateC;
      rsqState[3] = res.data.runStateD;
      rsqState[4] = res.data.runStateE;
      rsqState[5] = res.data.runStateF;
      rsqState[6] = res.data.runStateG;
      let hasZero = rsqState.includes("0");
      if (hasZero) {
        mesh.children[8].material = material;
        // scene.children[2].children[10].visible = true
        // scene.children[2].children[18].visible = true
        // scene.children[2].children[26].visible = true
        // scene.children[2].children[16].visible = true
        // scene.children[2].children[24].visible = true
        // scene.children[2].children[32].visible = true
        // scene.children[2].children[15].visible = true
        // scene.children[2].children[23].visible = true
        // scene.children[2].children[31].visible = true
        // scene.children[2].children[14].visible = true
        // scene.children[2].children[22].visible = true
        // scene.children[2].children[30].visible = true
        // scene.children[2].children[13].visible = true
        // scene.children[2].children[21].visible = true
        // scene.children[2].children[29].visible = true
        // scene.children[2].children[12].visible = true
        // scene.children[2].children[20].visible = true
        // scene.children[2].children[28].visible = true
        // scene.children[2].children[11].visible = true
        // scene.children[2].children[19].visible = true
        // scene.children[2].children[27].visible = true
        // scene.children[2].children[17].visible = true
        // scene.children[2].children[25].visible = true
        // scene.children[2].children[33].visible = true
      } else {
        mesh.children[8].material = touming;
        // scene.children[2].children[10].visible = false
        // scene.children[2].children[18].visible = false
        // scene.children[2].children[26].visible = false
        // scene.children[2].children[16].visible = false
        // scene.children[2].children[24].visible = false
        // scene.children[2].children[32].visible = false
        // scene.children[2].children[15].visible = false
        // scene.children[2].children[23].visible = false
        // scene.children[2].children[31].visible = false
        // scene.children[2].children[14].visible = false
        // scene.children[2].children[22].visible = false
        // scene.children[2].children[30].visible = false
        // scene.children[2].children[13].visible = false
        // scene.children[2].children[21].visible = false
        // scene.children[2].children[29].visible = false
        // scene.children[2].children[12].visible = false
        // scene.children[2].children[20].visible = false
        // scene.children[2].children[28].visible = false
        // scene.children[2].children[11].visible = false
        // scene.children[2].children[19].visible = false
        // scene.children[2].children[27].visible = false
        // scene.children[2].children[17].visible = false
        // scene.children[2].children[25].visible = false
        // scene.children[2].children[33].visible = false
      }
      // // if (document.getElementById('zbf_r_btns').children[8].className == "") {
      // //     for (let ahuo = 3; ahuo <= 30; ahuo++) {
      // //         scene.children[ahuo].visible = false
      // //     }
      // // } else {
      // //     if (document.getElementById('zbf_r_btns').children[0].className == "") {
      // //         scene.children[3].visible = false
      // //         scene.children[4].visible = false
      // //         scene.children[5].visible = false
      // //         scene.children[6].visible = false
      // //     } else {
      // if (rsqState[0] == 1) {
      //     scene.children[3].visible = false
      //     scene.children[4].visible = false
      //     scene.children[5].visible = false
      //     scene.children[6].visible = false
      //     // scene.children[2].children[6].visible = false
      // } else {
      //     scene.children[3].visible = true
      //     scene.children[4].visible = true
      //     scene.children[5].visible = true
      //     scene.children[6].visible = true
      //     // scene.children[2].children[6].visible = true
      // }
      // // }
      // // if (document.getElementById('zbf_r_btns').children[1].className == "") {
      // //     scene.children[7].visible = false
      // //     scene.children[8].visible = false
      // //     scene.children[9].visible = false
      // //     scene.children[10].visible =false
      // // } else {
      // if (rsqState[1] == 1) {
      //     scene.children[7].visible = false
      //     scene.children[8].visible = false
      //     scene.children[9].visible = false
      //     scene.children[10].visible = false
      // } else {
      //     scene.children[7].visible = true
      //     scene.children[8].visible = true
      //     scene.children[9].visible = true
      //     scene.children[10].visible = true
      //     // scene.children[2].children[5].visible = true
      // }
      // // }
      // // if (document.getElementById('zbf_r_btns').children[2].className == "") {
      // //     scene.children[11].visible = false
      // //     scene.children[12].visible = false
      // //     scene.children[13].visible = false
      // //     scene.children[14].visible = false
      // // }
      // // else {
      // if (rsqState[2] == 1) {
      //     scene.children[11].visible = false
      //     scene.children[12].visible = false
      //     scene.children[13].visible = false
      //     scene.children[14].visible = false
      // } else {
      //     scene.children[11].visible = true
      //     scene.children[12].visible = true
      //     scene.children[13].visible = true
      //     scene.children[14].visible = true
      //     // scene.children[2].children[4].visible = true
      // }
      // // }
      // // if (document.getElementById('zbf_r_btns').children[3].className == "") {
      // //     scene.children[15].visible = false
      // //     scene.children[16].visible = false
      // //     scene.children[17].visible = false
      // //     scene.children[18].visible = false
      // // }
      // // else {
      // if (rsqState[3] == 1) {
      //     scene.children[15].visible = false
      //     scene.children[16].visible = false
      //     scene.children[17].visible = false
      //     scene.children[18].visible = false
      //     // scene.children[2].children[3].visible = false
      // } else {
      //     scene.children[15].visible = true
      //     scene.children[16].visible = true
      //     scene.children[17].visible = true
      //     scene.children[18].visible = true
      //     // scene.children[2].children[3].visible = true
      // }
      // // }
      // // if (document.getElementById('zbf_r_btns').children[4].className == "") {
      // //     scene.children[19].visible = false
      // //     scene.children[20].visible = false
      // //     scene.children[21].visible = false
      // //     scene.children[22].visible = false
      // // } else {
      // if (rsqState[4] == 1) {
      //     scene.children[19].visible = false
      //     scene.children[20].visible = false
      //     scene.children[21].visible = false
      //     scene.children[22].visible = false
      //     // scene.children[2].children[2].visible = false
      // } else {
      //     scene.children[19].visible = true
      //     scene.children[20].visible = true
      //     scene.children[21].visible = true
      //     scene.children[22].visible = true
      //     // scene.children[2].children[2].visible = true
      // }
      // // }
      // // if (document.getElementById('zbf_r_btns').children[5].className == "") {
      // //     scene.children[23].visible = false
      // //     scene.children[24].visible = false
      // //     scene.children[25].visible = false
      // //     scene.children[26].visible = false
      // // } else {
      // if (rsqState[5] == 1) {
      //     scene.children[23].visible = false
      //     scene.children[24].visible = false
      //     scene.children[25].visible = false
      //     scene.children[26].visible = false
      //     // scene.children[2].children[1].visible = false

      // } else {
      //     scene.children[23].visible = true
      //     scene.children[24].visible = true
      //     scene.children[25].visible = true
      //     scene.children[26].visible = true
      //     // scene.children[2].children[1].visible = true

      // }
      // // }
      // // if (document.getElementById('zbf_r_btns').children[6].className == "") {
      // //     scene.children[27].visible = false
      // //     scene.children[28].visible = false
      // //     scene.children[29].visible = false
      // //     scene.children[30].visible = false
      // // } else {
      // if (rsqState[6] == 1) {
      //     scene.children[27].visible = false
      //     scene.children[28].visible = false
      //     scene.children[29].visible = false
      //     scene.children[30].visible = false
      //     // scene.children[2].children[7].visible = false

      // } else {
      //     scene.children[27].visible = true
      //     scene.children[28].visible = true
      //     scene.children[29].visible = true
      //     scene.children[30].visible = true
      //     // scene.children[2].children[7].visible = true

      // }
      // // if (rsqState[7] == 1) {
      // //     scene.children[2].children[10].visible = false
      // //     scene.children[2].children[18].visible = false
      // //     scene.children[2].children[26].visible = false
      // // } else {
      // //     scene.children[2].children[10].visible = true
      // //     scene.children[2].children[18].visible = true
      // //     scene.children[2].children[26].visible = true
      // // }
      // // }
      // // }

      // // }

      // res.code == 200 && res.data && set3DFloorColor(res.data)
      // setData(res.result)
      // res.result && res.result.dataList && res.result.dataList.length > 0 && initEventList(res.result.dataList)
      get3DFloorColorshishi = setInterval(() => {
        get3DFloorColor();
      }, 1000);
      removeLoader("加载中....");
    });
  };

  // {"code":"200","message":"成功",
  // "result":{"runStateA":0,"centerTempSOFA":1475.56,"centerTempE":1684.98,"centerTempD":1636.195,"runStateE":0,"centerTempC":1742.2875000000001,"runStateD":0,"centerTempB":1814.58,"runStateC":0,"centerTempA":1813.02,"runStateB":0}}
  // const set3DFloorColor = (obj) => {
  //     // 12-17 sofa -a 操作透明度 停磨需隐藏
  //     // 18-23  sofa -a 蓝色风  停磨需隐藏
  //     let nameArr = ["A", "B", "C", "D", "E", "F", "G", "SOFA"]
  //     for (let index = 0; index < nameArr.length; index++) {
  //         const element = nameArr[index];
  //         if (obj[`runState${nameArr[index]}`] == 1) {

  //         } else {
  //             let newTemp = obj[`centerTemp${nameArr[index]}`] > 1800 ? 1800 : obj[`centerTemp${nameArr[index]}`] < 1500 ? 1500 : obj[`centerTemp${nameArr[index]}`]
  //             scene.children[2].children[17 - index].material.opacity = newTemp == 0 ? 1 : ((1800 - newTemp) / 300).toFixed(2)
  //             // if (oRBtns[index].className == "active") {
  //             //     index == 5 ? "" : scene.children[2].children[23 - index].visible = true
  //             //     mesh.children[23].visible = false
  //             //     mesh.children[15].visible = false
  //             //     mesh.children[14].visible = false
  //             //     mesh.children[13].visible = false
  //             //     mesh.children[12].visible = false
  //             // }
  //             // console.log(scene.children[2].children[17-index].name,scene.children[2].children[17].material.opacity,newTemp);
  //         }

  //     }

  // }
  // const setZhDis = (nub) => {//重置着火距离
  //     let c_3 = document.querySelector('.c_3').children
  //     // let arr = ["A", "B", "C", "D", "E", "燃尽风"]//,"燃尽风1","燃尽风2"
  //     let arr = ["A", "B", "C", "D", "E", "F", "G", "SOFA"]//,"燃尽风1","燃尽风2"
  //     let oPointerDis = document.getElementsByClassName('pointer_name')//着火距离点位
  //     //着火距离132
  //     casd.sort(function (a, b) {
  //         let valueA = a.value.toUpperCase(); // 不区分大小写进行排序
  //         let valueB = b.value.toUpperCase(); // 不区分大小写进行排序
  //         if (valueA < valueB) {
  //             return -1;
  //         }
  //         if (valueA > valueB) {
  //             return 1;
  //         }
  //         return 0;
  //     });
  //     // if (getzhunshu.zs !== undefined) {
  //     //     if (getzhunshu.zs[0] === 0) { c_3[1].style.display = "none" } else { c_3[1].style.display = "block" }
  //     //     if (getzhunshu.zs[1] === 0) { c_3[0].style.display = "none" } else { c_3[0].style.display = "block" }
  //     //     if (getzhunshu.zs[2] === 0) { c_3[3].style.display = "none" } else { c_3[3].style.display = "block" }
  //     //     if (getzhunshu.zs[3] === 0) { c_3[2].style.display = "none" } else { c_3[2].style.display = "block" }
  //     // } else {
  //     //     for (let index = 0; index < c_3.length; index++) {
  //     //         c_3[index].style.display = "none"
  //     //     }
  //     // }
  //     if (runState == 0) {
  //         oPointerDis[0].innerHTML = nub + 1 + (nub == "SOFA" ? "" : ": " + Number(casd[0].label.toFixed()) + "mm");
  //         oPointerDis[1].innerHTML = nub + 2 + (nub == "SOFA" ? "" : ": " + Number(casd[1].label.toFixed()) + "mm");
  //         oPointerDis[2].innerHTML = nub + 3 + (nub == "SOFA" ? "" : ": " + Number(casd[2].label.toFixed()) + "mm");
  //         oPointerDis[3].innerHTML = nub + 4 + (nub == "SOFA" ? "" : ": " + Number(casd[3].label.toFixed()) + "mm");
  //         let c_2 = document.getElementsByClassName('c_2')[0].children

  //         if (Number(casd[0].label.toFixed() >= 400)) {
  //             c_2[1].style.scale = 1.6
  //             c_3[1].style.display = "block"
  //         } else if (Number(casd[0].label.toFixed() == 0)) {
  //             c_2[1].style.scale = 0
  //             c_3[1].style.display = "none"
  //         } else {
  //             c_2[1].style.scale = 1
  //             c_3[1].style.display = "block"
  //         }
  //         if (Number(casd[1].label.toFixed() >= 400)) {
  //             c_2[0].style.scale = 1.6
  //             c_3[0].style.display = "block"
  //         } else if (Number(casd[1].label.toFixed() == 0)) {
  //             c_2[0].style.scale = 0
  //             c_3[0].style.display = "none"
  //         } else {
  //             c_2[0].style.scale = 1
  //             c_3[0].style.display = "block"
  //         }
  //         if (Number(casd[2].label.toFixed() >= 400)) {
  //             c_2[2].style.scale = 1.6
  //             c_3[3].style.display = 'block'
  //         } else if (Number(casd[2].label.toFixed() == 0)) {
  //             c_2[2].style.scale = 0
  //             c_3[3].style.display = 'none'
  //         } else {
  //             c_2[2].style.scale = 1
  //             c_3[3].style.display = 'block'
  //         }
  //         if (Number(casd[3].label.toFixed() >= 400)) {
  //             c_2[3].style.scale = 1.6
  //             c_3[2].style.display = 'block'
  //         } else if (Number(casd[3].label.toFixed() == 0)) {
  //             c_2[3].style.scale = 0
  //             c_3[2].style.display = 'none'
  //         } else {
  //             c_2[3].style.scale = 1
  //             c_3[2].style.display = 'block'
  //         } //改变火焰大小  1000对应 1  2000对应1.2
  //     } else {
  //         oPointerDis[0].innerHTML = nub + 1
  //         oPointerDis[1].innerHTML = nub + 2
  //         oPointerDis[2].innerHTML = nub + 3
  //         oPointerDis[3].innerHTML = nub + 4
  //     }

  //     // removeLoader()

  // }
  // const initRight = (obj) => {
  //     //console.log("重置温度场分布", document.getElementsByClassName("hjm_zhjl")[0].children[4])
  //     // let blArr = obj.tempFieldResult
  //     let blArr = obj.tempFieldArrayResult

  //     obj.runState == 1
  //     let oPointerWd = document.getElementsByClassName('hjm_wd_block')//着火距离点位
  //     // console.log(blArr[0][8].toFixed());
  //     let nowWenDU = blArr[0][8].toFixed() //现在取的温度值
  //     let c_1 = document.getElementsByClassName('c_1')[0]
  //     let c_2 = document.getElementsByClassName('c_2')[0].children

  //     nowWenDU > 1800 ? nowWenDU = 1800 : nowWenDU < 1500 ? nowWenDU = 1500 : ""
  //     c_1.style.opacity = nowWenDU == 0 ? 0 : ((1800 - nowWenDU) / 300).toFixed(2)//改变温度颜色 1500 对应 1    1800对应 0
  //     for (let index = 0; index < c_2.length; index++) {
  //         const element = c_2[index];
  //         element.style.scale = 1 + (nowWenDU / 10000).toFixed(2) * 1 //改变火焰大小  1000对应 1  2000对应1.2
  //     }

  //     blArr.forEach((item, i) => {
  //         item.forEach((otem, oi) => {
  //             oPointerWd[i].children[oi].innerHTML = otem.toFixed()
  //             let nowValue = otem.toFixed()
  //             let position = nowValue > upWd ? 255 : nowValue < loweWd ? 0 : ((nowValue - loweWd) * 255 / (upWd - loweWd)).toFixed()
  //             let color = colorPicker(position)
  //             // console.log(position, ((wdArr[i] * (otem * 10000)) / 10000).toFixed());
  //             // let color1=colorPicker(position)
  //             // console.log(`rgb(${color[0]},${color[1]},${color[2]})`);
  //             oPointerWd[i].children[oi].style.background = `rgb(${color[0]},${color[1]},${color[2]})`
  //         });

  //     });

  // }
  // const setWhichFlood = (oi) => {
  //     // lsLoader("加载中...")

  //     // let arr = ["A", "B", "C", "D", "E", "燃尽风"]//,"燃尽风1","燃尽风2"
  //     let arr = ["A", "B", "C", "D", "E", "F", "G", "SOFA"]//,"燃尽风1","燃尽风2"
  //     let oTitle = document.getElementsByClassName('title')//标题
  //     let oA2A3 = document.getElementsByClassName('_t')//A2A3
  //     let oA1A4 = document.getElementsByClassName('_d')//A1A4
  //     // console.log(oA2A3, oA1A4);
  //     for (let i = 0; i < oA2A3.length; i++) {
  //         oA2A3[i].children[0].innerHTML = oi + 2;
  //         oA2A3[i].children[2].innerHTML = oi + 3;
  //     }
  //     for (let i = 0; i < oA1A4.length; i++) {
  //         oA1A4[i].children[0].innerHTML = oi + 1;
  //         oA1A4[i].children[2].innerHTML = oi + 4;
  //     }

  //     // for (let i = 0; i < oTitle.length; i++) {
  //     //     let str = i == 0 ? "层燃烧器着火距离监测" : i == 1 ? "层燃烧器截面温度场偏烧情况" : "层燃烧器截面温度场分布"
  //     //     oTitle[i].children[0].innerHTML = oi + str;
  //     // }

  // }
  // 绘制颜色映射图
  // const defaultColorStops = { 0: "#0019ff", 0.1: "#00d8ff", 0.2: "#00dc50", 0.25: "#ffee00", 0.9: "#ff1800", 1: "#ff0000" };
  // const width = 20, height = 256;
  // const loweWd = 400, upWd = 1500
  // // linear-gradient(to bottom, #ff1800, #ffee00, #00dc50, #00d8ff, #0019ff)
  // // / 创建canvas
  // let canvas = document.createElement("canvas");
  // canvas.width = width;
  // canvas.height = height;
  // // document.getElementById('_c').appendChild(canvas)
  // let ctx = canvas.getContext("2d");
  // // 创建线性渐变色
  // let linearGradient = ctx.createLinearGradient(0, 0, width, height);
  // for (const key in defaultColorStops) {
  //     linearGradient.addColorStop(key, defaultColorStops[key]);
  // }
  // // 绘制渐变色条
  // ctx.fillStyle = linearGradient;
  // ctx.fillRect(0, 0, width, height);
  // // 读取像素数据
  // let imageData = ctx.getImageData(0, 0, 1, height).data;
  // const colorPicker = (position) => {
  //     return imageData.slice(position * 4, position * 4 + 3);
  // }

  // let casd = []
  // const getData = () => {
  //     // 初始化表单数据
  //     let ccc = [{ level: "A" }, { level: "B" }, { level: "C" }, { level: "D" }, { level: "E" }, { level: "F" }, { level: "G" }, { level: "SOFA" }]
  //     let arr = ["A", "B", "C", "D", "E", "F", "G", "SOFA"]
  //     request.post('/spf/visit/getThermalField', ccc[currentMethodIndex]).then(res => {
  //         res.data && res.data.tempFieldArrayResult && res.data.tempFieldArrayResult.length > 0 && initRight(res.data)
  //         let arrbox = []
  //         for (let key in res.data.distince) {
  //             arrbox.push({
  //                 label: res.data.distince[key], // label 字段
  //                 value: key   // value字段
  //             })
  //         }

  //         if (arr[currentMethodIndex] == "燃尽风") {
  //             document.querySelector(".hjm_zhjl .c .c_2").style.opacity = "0"
  //         } else {
  //             if (res.data.runState == 1) {
  //                 document.querySelector(".hjm_zhjl .c .c_2").style.opacity = "0"
  //             } else {
  //                 document.querySelector(".hjm_zhjl .c .c_2").style.opacity = "1"
  //             }
  //         }
  //         console.log(res.data);
  //         casd = arrbox
  //         runState = res.data.runState
  //         setZhDis(arr[currentMethodIndex - 1])
  //         setWhichFlood(arr[currentMethodIndex - 1])
  //         removeLoader()
  //     })
  // }
  initEvent("zbf_foot_btns", true); //底部菜单 btns
  let oIndexDivA = document.getElementById("index_rsszhjkA");
  let result = [[], [], [], [], [], [], []];
  let strbox = [[], [], [], [], [], [], []];
  let sofastrbox = [[]];
  const initDataFromINnput = () => {
    //console.log(rsqState);
    request.get("/api/sjdl/home/point/value").then((res) => {
      let tablenumber = [];
      Array(tablenumber);
      let tablebox = [];
      //重置数据
      // 获取输入框值  5 6  8 9  11 12  14 15  17 18  20 21   23 24

      for (let key in res.data) {
        tablebox.push({
          label: res.data[key], // label 字段
          value: key, // value字段
        });
      }
      tablebox.sort(function (a, b) {
        return (a.value + "").localeCompare(b.value + "");
      });

      // console.log('res', res);
      // console.log('tablebox', tablebox);

      tablebox.forEach((item) => {
        switch (item.value) {
          case "A1":
          case "A2":
          case "A3":
          case "A4":
            result[0].push(item);
            break;
          case "B1":
          case "B2":
          case "B3":
          case "B4":
            result[1].push(item);
            break;
          case "C1":
          case "C2":
          case "C3":
          case "C4":
            result[2].push(item);
            break;
          case "D1":
          case "D2":
          case "D3":
          case "D4":
            result[3].push(item);
            break;
          case "E1":
          case "E2":
          case "E3":
          case "E4":
            result[4].push(item);
            break;
          case "F1":
          case "F2":
          case "F3":
          case "F4":
            result[5].push(item);
            break;
          case "G1":
          case "G2":
          case "G3":
          case "G4":
            result[6].push(item);
            break;
          default:
            break;
        }
      });
      // console.log('result', result);
      for (let i = 0; i < result.length; i++) {
        let str = "";
        for (let index = 0; index < 3; index++) {
          str +=
            '<p><span style="color:#343434">' +
            (index == 0
              ? "温度(°C)"
              : index == 1
              ? "着火距离(mm)"
              : index == 2
              ? "燃烧稳定性(%)"
              : "") +
            "</span>";
          for (let k = 0; k < 4; k++) {
            //i < 24
            // let nowValue = Number(document.getElementById(startId + 4 + "").value).toFixed(0)
            let nowValueTR = Math.floor(result[i][k].label.TR, 0);
            let nowValuedis = Math.floor(result[i][k].label.ZHJL.toFixed(0), 0);
            let nowValuerawdx = Math.floor(
              result[i][k].label.RSWDX.toFixed(0),
              0
            );
            let level_1 = result[i][k].label.warnData.tempLowLower.toFixed(0);
            let level_2 = result[i][k].label.warnData.tempLower.toFixed(0);
            let level_3 = result[i][k].label.warnData.tempUpUpper.toFixed(0);
            let level_4 = result[i][k].label.warnData.tempUpper.toFixed(0);
            let level_5 =
              result[i][k].label.warnData.distinceLowLower.toFixed(0);
            let level_6 = result[i][k].label.warnData.distinceLower.toFixed(0);
            let level_7 =
              result[i][k].label.warnData.distinceUpUpper.toFixed(0);
            let level_8 = result[i][k].label.warnData.distinceUpper.toFixed(0);
            let level_9 =
              result[i][k].label.warnData.stabilityLowLower.toFixed(0);
            let level_10 =
              result[i][k].label.warnData.stabilityLower.toFixed(0);
            // if (rsqState[i] == 1) { //停磨
            //     if (index == 0 && Number(nowValueTR) > 1450) { //温度大于1450 标红
            //         str += '<span style="color:red;width:100px">' + nowValueTR + '</span>'
            //     } else if (index > 0) {
            //         str += '<span style="color:#06FF00;width:100px">' + '0' + '</span>'
            //     } else {
            //         str += '<span style="color:#06FF00;width:100px">' + nowValueTR + '</span>'
            //     }
            // }
            //  else {
            if (index == 0) {
              if (nowValueTR == 25) {
                str +=
                  '<span style="color:#06FF00;width:100px">' +
                  nowValueTR +
                  "</span>";
              } else if (level_3 <= nowValueTR || nowValueTR <= level_1) {
                str +=
                  '<span style="color:red;width:100px">' +
                  nowValueTR +
                  "</span>";
              } else if (level_1 <= nowValueTR && nowValueTR <= level_4) {
                str +=
                  '<span style="color:#06FF00;width:100px">' +
                  nowValueTR +
                  "</span>";
              } else if (
                (level_1 <= nowValueTR && nowValueTR <= level_2) ||
                (level_4 <= nowValueTR && nowValueTR <= level_3)
              ) {
                str +=
                  '<span style="color:yellow;width:100px">' +
                  nowValueTR +
                  "</span>";
              }
            } else if (index == 1) {
              if (nowValuedis == 0) {
                str +=
                  '<span style="color:#06FF00;width:100px">' +
                  nowValuedis +
                  "</span>";
              } else if (level_7 <= nowValuedis || nowValuedis <= level_5) {
                str +=
                  '<span style="color:red;width:100px">' +
                  nowValuedis +
                  "</span>";
              } else if (level_5 <= nowValuedis && nowValuedis <= level_8) {
                str +=
                  '<span style="color:#06FF00;width:100px">' +
                  nowValuedis +
                  "</span>";
              } else if (
                (level_5 <= nowValuedis && nowValuedis <= level_6) ||
                (level_8 <= nowValuedis && nowValuedis <= level_7)
              ) {
                str +=
                  '<span style="color:yellow;width:100px">' +
                  nowValuedis +
                  "</span>";
              }
            } else {
              if (nowValuerawdx == 0) {
                str +=
                  '<span style="color:#06FF00;width:100px">' +
                  nowValuerawdx +
                  "</span>";
              } else if (nowValuerawdx <= level_9) {
                str +=
                  '<span style="color:red;width:100px">' +
                  nowValuerawdx +
                  "</span>";
              } else if (nowValuerawdx >= level_10) {
                str +=
                  '<span style="color:#06FF00;width:100px">' +
                  nowValuerawdx +
                  "</span>";
              } else if (
                level_9 <= nowValuerawdx &&
                nowValuerawdx <= level_10
              ) {
                str +=
                  '<span style="color:yellow;width:100px">' +
                  nowValuerawdx +
                  "</span>";
              }
            }
          }
          str += "</p>";
        }
        strbox[i] = str;
        if (oIndexDivA.innerHTML == "") {
          oIndexDivA.innerHTML = strbox[0];
        }
      }
      let sofabox = [[]];
      tablebox.forEach((item) => {
        switch (item.value) {
          case "SOFA1":
          case "SOFA2":
          case "SOFA3":
          case "SOFA4":
            sofabox[0].push(item);
          default:
            break;
        }
      });
      // console.log(sofabox)
      for (let i = 0; i < sofabox[0].length; i++) {
        let str = "";
        for (let index = 0; index < 1; index++) {
          str +=
            '<p><span style="color:#343434">' +
            (index == 0 ? "温度(°C)" : "") +
            "</span>";
          for (let k = 0; k < 4; k++) {
            //i < 24
            // let nowValue = Number(document.getElementById(startId + 4 + "").value).toFixed(0)
            let nowValueTR = Math.floor(sofabox[0][k].label.TR.toFixed(0));
            let level_1 = sofabox[0][k].label.warnData.tempLowLower;
            let level_2 = sofabox[0][k].label.warnData.tempLower;
            let level_3 = sofabox[0][k].label.warnData.tempUpUpper;
            let level_4 = sofabox[0][k].label.warnData.tempUpper;
            // if (rsqState[i] == 1) { //停磨
            //     if (index == 0 && Number(nowValueTR) > 1450) { //温度大于1450 标红
            //         str += '<span style="color:red;width:100px">' + nowValueTR + '</span>'
            //     } else if (index > 0) {
            //         str += '<span style="color:#06FF00;width:100px">' + '0' + '</span>'

            //     } else {
            //         str += '<span style="color:#06FF00;width:100px">' + nowValueTR + '</span>'
            //     }

            // }
            //  else {
            // console.log('nowValueTR', nowValueTR)
            if (index == 0) {
              if (nowValueTR == 25) {
                str +=
                  '<span style="color:#06FF00;width:100px">' +
                  nowValueTR +
                  "</span>";
              } else if (level_3 <= nowValueTR || nowValueTR <= level_1) {
                str +=
                  '<span style="color:red;width:100px">' +
                  nowValueTR +
                  "</span>";
              } else if (level_1 <= nowValueTR && nowValueTR <= level_4) {
                str +=
                  '<span style="color:#06FF00;width:100px">' +
                  nowValueTR +
                  "</span>";
              } else if (
                (level_1 <= nowValueTR && nowValueTR <= level_2) ||
                (level_4 <= nowValueTR && nowValueTR <= level_3)
              ) {
                str +=
                  '<span style="color:yellow;width:100px">' +
                  nowValueTR +
                  "</span>";
              }
            }
          }
          str += "</p>";
        }

        sofastrbox[0] = str;
      }
    });
  };
  let methods = [
    function () {
      $("#tanchuangshow").style.display = "none";
      $("#namechangge0").innerHTML = "A层监测项";
      $("#namechangge1").innerHTML = "A1";
      $("#namechangge2").innerHTML = "A2";
      $("#namechangge3").innerHTML = "A3";
      $("#namechangge4").innerHTML = "A4";

      oIndexDivA.innerHTML = strbox[0];
      if (rsqState[0] == 1) {
        scene.children[2].children[0].visible = false;
        scene.children[2].children[10].visible = false;
        scene.children[2].children[18].visible = false;
        scene.children[2].children[26].visible = false;
        scene.children[2].children[6].visible = true;
        scene.children[2].children[16].visible = true;
        scene.children[2].children[24].visible = true;
        scene.children[2].children[32].visible = true;

        scene.children[2].children[5].visible = false;
        scene.children[2].children[15].visible = false;
        scene.children[2].children[23].visible = false;
        scene.children[2].children[31].visible = false;

        scene.children[2].children[4].visible = false;
        scene.children[2].children[14].visible = false;
        scene.children[2].children[22].visible = false;
        scene.children[2].children[30].visible = false;

        scene.children[2].children[3].visible = false;
        scene.children[2].children[13].visible = false;
        scene.children[2].children[21].visible = false;
        scene.children[2].children[29].visible = false;

        scene.children[2].children[2].visible = false;
        scene.children[2].children[12].visible = false;
        scene.children[2].children[20].visible = false;
        scene.children[2].children[28].visible = false;

        scene.children[2].children[1].visible = false;
        scene.children[2].children[11].visible = false;
        scene.children[2].children[19].visible = false;
        scene.children[2].children[27].visible = false;

        scene.children[2].children[7].visible = false;
        scene.children[2].children[17].visible = false;
        scene.children[2].children[25].visible = false;
        scene.children[2].children[33].visible = false;

        scene.remove(krq1, krq2, krq3, krq4);
        scene.remove(krq5, krq6, krq7, krq8);
        scene.remove(krq9, krq10, krq11, krq12);
        scene.remove(krq13, krq14, krq15, krq16);
        scene.remove(krq17, krq18, krq19, krq20);
        scene.remove(krq21, krq22, krq23, krq24);
        scene.remove(krq25, krq26, krq27, krq28);
      } else {
        scene.children[2].children[0].visible = false;
        scene.children[2].children[10].visible = false;
        scene.children[2].children[18].visible = false;
        scene.children[2].children[26].visible = false;
        scene.children[2].children[6].visible = true;
        scene.children[2].children[16].visible = true;
        scene.children[2].children[24].visible = true;
        scene.children[2].children[32].visible = true;

        scene.children[2].children[5].visible = false;
        scene.children[2].children[15].visible = false;
        scene.children[2].children[23].visible = false;
        scene.children[2].children[31].visible = false;

        scene.children[2].children[4].visible = false;
        scene.children[2].children[14].visible = false;
        scene.children[2].children[22].visible = false;
        scene.children[2].children[30].visible = false;

        scene.children[2].children[3].visible = false;
        scene.children[2].children[13].visible = false;
        scene.children[2].children[21].visible = false;
        scene.children[2].children[29].visible = false;

        scene.children[2].children[2].visible = false;
        scene.children[2].children[12].visible = false;
        scene.children[2].children[20].visible = false;
        scene.children[2].children[28].visible = false;

        scene.children[2].children[1].visible = false;
        scene.children[2].children[11].visible = false;
        scene.children[2].children[19].visible = false;
        scene.children[2].children[27].visible = false;

        scene.children[2].children[7].visible = false;
        scene.children[2].children[17].visible = false;
        scene.children[2].children[25].visible = false;
        scene.children[2].children[33].visible = false;

        scene.add(krq1, krq2, krq3, krq4);
        scene.remove(krq5, krq6, krq7, krq8);
        scene.remove(krq9, krq10, krq11, krq12);
        scene.remove(krq13, krq14, krq15, krq16);
        scene.remove(krq17, krq18, krq19, krq20);
        scene.remove(krq21, krq22, krq23, krq24);
        scene.remove(krq25, krq26, krq27, krq28);
      }
    },
    function () {
      $("#tanchuangshow").style.display = "none";
      $("#namechangge0").innerHTML = "B层监测项";
      $("#namechangge1").innerHTML = "B1";
      $("#namechangge2").innerHTML = "B2";
      $("#namechangge3").innerHTML = "B3";
      $("#namechangge4").innerHTML = "B4";
      oIndexDivA.innerHTML = strbox[1];
      if (rsqState[1] == 1) {
        scene.children[2].children[0].visible = false;
        scene.children[2].children[10].visible = false;
        scene.children[2].children[18].visible = false;
        scene.children[2].children[6].visible = false;
        scene.children[2].children[16].visible = false;
        scene.children[2].children[24].visible = false;
        scene.children[2].children[32].visible = false;

        scene.children[2].children[5].visible = true;
        scene.children[2].children[15].visible = true;
        scene.children[2].children[23].visible = true;
        scene.children[2].children[31].visible = true;

        scene.children[2].children[4].visible = false;
        scene.children[2].children[14].visible = false;
        scene.children[2].children[22].visible = false;
        scene.children[2].children[30].visible = false;

        scene.children[2].children[3].visible = false;
        scene.children[2].children[13].visible = false;
        scene.children[2].children[21].visible = false;
        scene.children[2].children[29].visible = false;

        scene.children[2].children[2].visible = false;
        scene.children[2].children[12].visible = false;
        scene.children[2].children[20].visible = false;
        scene.children[2].children[28].visible = false;

        scene.children[2].children[1].visible = false;
        scene.children[2].children[11].visible = false;
        scene.children[2].children[19].visible = false;
        scene.children[2].children[27].visible = false;

        scene.children[2].children[7].visible = false;
        scene.children[2].children[17].visible = false;
        scene.children[2].children[25].visible = false;
        scene.children[2].children[33].visible = false;

        scene.remove(krq1, krq2, krq3, krq4);
        scene.remove(krq5, krq6, krq7, krq8);
        scene.remove(krq9, krq10, krq11, krq12);
        scene.remove(krq13, krq14, krq15, krq16);
        scene.remove(krq17, krq18, krq19, krq20);
        scene.remove(krq21, krq22, krq23, krq24);
        scene.remove(krq25, krq26, krq27, krq28);
      } else {
        scene.children[2].children[0].visible = false;
        scene.children[2].children[10].visible = false;
        scene.children[2].children[18].visible = false;
        scene.children[2].children[6].visible = false;
        scene.children[2].children[16].visible = false;
        scene.children[2].children[24].visible = false;
        scene.children[2].children[32].visible = false;

        scene.children[2].children[5].visible = true;
        scene.children[2].children[15].visible = true;
        scene.children[2].children[23].visible = true;
        scene.children[2].children[31].visible = true;

        scene.children[2].children[4].visible = false;
        scene.children[2].children[14].visible = false;
        scene.children[2].children[22].visible = false;
        scene.children[2].children[30].visible = false;

        scene.children[2].children[3].visible = false;
        scene.children[2].children[13].visible = false;
        scene.children[2].children[21].visible = false;
        scene.children[2].children[29].visible = false;

        scene.children[2].children[2].visible = false;
        scene.children[2].children[12].visible = false;
        scene.children[2].children[20].visible = false;
        scene.children[2].children[28].visible = false;

        scene.children[2].children[1].visible = false;
        scene.children[2].children[11].visible = false;
        scene.children[2].children[19].visible = false;
        scene.children[2].children[27].visible = false;

        scene.children[2].children[7].visible = false;
        scene.children[2].children[17].visible = false;
        scene.children[2].children[25].visible = false;
        scene.children[2].children[33].visible = false;

        scene.remove(krq1, krq2, krq3, krq4);
        scene.add(krq5, krq6, krq7, krq8);
        scene.remove(krq9, krq10, krq11, krq12);
        scene.remove(krq13, krq14, krq15, krq16);
        scene.remove(krq17, krq18, krq19, krq20);
        scene.remove(krq21, krq22, krq23, krq24);
        scene.remove(krq25, krq26, krq27, krq28);
      }
    },
    function () {
      $("#tanchuangshow").style.display = "none";
      $("#namechangge0").innerHTML = "C层监测项";
      $("#namechangge1").innerHTML = "C1";
      $("#namechangge2").innerHTML = "C2";
      $("#namechangge3").innerHTML = "C3";
      $("#namechangge4").innerHTML = "C4";
      oIndexDivA.innerHTML = strbox[2];
      if (rsqState[2] == 1) {
        scene.children[2].children[0].visible = false;
        scene.children[2].children[10].visible = false;
        scene.children[2].children[18].visible = false;
        scene.children[2].children[26].visible = false;
        scene.children[2].children[6].visible = false;
        scene.children[2].children[16].visible = false;
        scene.children[2].children[24].visible = false;
        scene.children[2].children[32].visible = false;

        scene.children[2].children[5].visible = false;
        scene.children[2].children[15].visible = false;
        scene.children[2].children[23].visible = false;
        scene.children[2].children[31].visible = false;

        scene.children[2].children[4].visible = true;
        scene.children[2].children[14].visible = true;
        scene.children[2].children[22].visible = true;
        scene.children[2].children[30].visible = true;

        scene.children[2].children[3].visible = false;
        scene.children[2].children[13].visible = false;
        scene.children[2].children[21].visible = false;
        scene.children[2].children[29].visible = false;

        scene.children[2].children[2].visible = false;
        scene.children[2].children[12].visible = false;
        scene.children[2].children[20].visible = false;
        scene.children[2].children[28].visible = false;

        scene.children[2].children[1].visible = false;
        scene.children[2].children[11].visible = false;
        scene.children[2].children[19].visible = false;
        scene.children[2].children[27].visible = false;

        scene.children[2].children[7].visible = false;
        scene.children[2].children[17].visible = false;
        scene.children[2].children[25].visible = false;
        scene.children[2].children[33].visible = false;

        scene.remove(krq1, krq2, krq3, krq4);
        scene.remove(krq5, krq6, krq7, krq8);
        scene.remove(krq9, krq10, krq11, krq12);
        scene.remove(krq13, krq14, krq15, krq16);
        scene.remove(krq17, krq18, krq19, krq20);
        scene.remove(krq21, krq22, krq23, krq24);
        scene.remove(krq25, krq26, krq27, krq28);
      } else {
        scene.children[2].children[0].visible = false;
        scene.children[2].children[10].visible = false;
        scene.children[2].children[18].visible = false;
        scene.children[2].children[26].visible = false;
        scene.children[2].children[6].visible = false;
        scene.children[2].children[16].visible = false;
        scene.children[2].children[24].visible = false;
        scene.children[2].children[32].visible = false;

        scene.children[2].children[5].visible = false;
        scene.children[2].children[15].visible = false;
        scene.children[2].children[23].visible = false;
        scene.children[2].children[31].visible = false;

        scene.children[2].children[4].visible = true;
        scene.children[2].children[14].visible = true;
        scene.children[2].children[22].visible = true;
        scene.children[2].children[30].visible = true;

        scene.children[2].children[3].visible = false;
        scene.children[2].children[13].visible = false;
        scene.children[2].children[21].visible = false;
        scene.children[2].children[29].visible = false;

        scene.children[2].children[2].visible = false;
        scene.children[2].children[12].visible = false;
        scene.children[2].children[20].visible = false;
        scene.children[2].children[28].visible = false;

        scene.children[2].children[1].visible = false;
        scene.children[2].children[11].visible = false;
        scene.children[2].children[19].visible = false;
        scene.children[2].children[27].visible = false;

        scene.children[2].children[7].visible = false;
        scene.children[2].children[17].visible = false;
        scene.children[2].children[25].visible = false;
        scene.children[2].children[33].visible = false;

        scene.remove(krq1, krq2, krq3, krq4);
        scene.remove(krq5, krq6, krq7, krq8);
        scene.add(krq9, krq10, krq11, krq12);
        scene.remove(krq13, krq14, krq15, krq16);
        scene.remove(krq17, krq18, krq19, krq20);
        scene.remove(krq21, krq22, krq23, krq24);
        scene.remove(krq25, krq26, krq27, krq28);
      }
    },
    function () {
      $("#tanchuangshow").style.display = "none";
      $("#namechangge0").innerHTML = "D层监测项";
      $("#namechangge1").innerHTML = "D1";
      $("#namechangge2").innerHTML = "D2";
      $("#namechangge3").innerHTML = "D3";
      $("#namechangge4").innerHTML = "D4";
      oIndexDivA.innerHTML = strbox[3];
      if (rsqState[3] == 1) {
        scene.children[2].children[0].visible = false;
        scene.children[2].children[10].visible = false;
        scene.children[2].children[18].visible = false;
        scene.children[2].children[26].visible = false;
        scene.children[2].children[6].visible = false;
        scene.children[2].children[16].visible = false;
        scene.children[2].children[24].visible = false;
        scene.children[2].children[32].visible = false;

        scene.children[2].children[5].visible = false;
        scene.children[2].children[15].visible = false;
        scene.children[2].children[23].visible = false;
        scene.children[2].children[31].visible = false;

        scene.children[2].children[4].visible = false;
        scene.children[2].children[14].visible = false;
        scene.children[2].children[22].visible = false;
        scene.children[2].children[30].visible = false;

        scene.children[2].children[3].visible = true;
        scene.children[2].children[13].visible = true;
        scene.children[2].children[21].visible = true;
        scene.children[2].children[29].visible = true;

        scene.children[2].children[2].visible = false;
        scene.children[2].children[12].visible = false;
        scene.children[2].children[20].visible = false;
        scene.children[2].children[28].visible = false;

        scene.children[2].children[1].visible = false;
        scene.children[2].children[11].visible = false;
        scene.children[2].children[19].visible = false;
        scene.children[2].children[27].visible = false;

        scene.children[2].children[7].visible = false;
        scene.children[2].children[17].visible = false;
        scene.children[2].children[25].visible = false;
        scene.children[2].children[33].visible = false;

        scene.remove(krq1, krq2, krq3, krq4);
        scene.remove(krq5, krq6, krq7, krq8);
        scene.remove(krq9, krq10, krq11, krq12);
        scene.remove(krq13, krq14, krq15, krq16);
        scene.remove(krq17, krq18, krq19, krq20);
        scene.remove(krq21, krq22, krq23, krq24);
        scene.remove(krq25, krq26, krq27, krq28);
      } else {
        scene.children[2].children[0].visible = false;
        scene.children[2].children[10].visible = false;
        scene.children[2].children[18].visible = false;
        scene.children[2].children[26].visible = false;
        scene.children[2].children[6].visible = false;
        scene.children[2].children[16].visible = false;
        scene.children[2].children[24].visible = false;
        scene.children[2].children[32].visible = false;

        scene.children[2].children[5].visible = false;
        scene.children[2].children[15].visible = false;
        scene.children[2].children[23].visible = false;
        scene.children[2].children[31].visible = false;

        scene.children[2].children[4].visible = false;
        scene.children[2].children[14].visible = false;
        scene.children[2].children[22].visible = false;
        scene.children[2].children[30].visible = false;

        scene.children[2].children[3].visible = true;
        scene.children[2].children[13].visible = true;
        scene.children[2].children[21].visible = true;
        scene.children[2].children[29].visible = true;

        scene.children[2].children[2].visible = false;
        scene.children[2].children[12].visible = false;
        scene.children[2].children[20].visible = false;
        scene.children[2].children[28].visible = false;

        scene.children[2].children[1].visible = false;
        scene.children[2].children[11].visible = false;
        scene.children[2].children[19].visible = false;
        scene.children[2].children[27].visible = false;

        scene.children[2].children[7].visible = false;
        scene.children[2].children[17].visible = false;
        scene.children[2].children[25].visible = false;
        scene.children[2].children[33].visible = false;

        scene.remove(krq1, krq2, krq3, krq4);
        scene.remove(krq5, krq6, krq7, krq8);
        scene.remove(krq9, krq10, krq11, krq12);
        scene.add(krq13, krq14, krq15, krq16);
        scene.remove(krq17, krq18, krq19, krq20);
        scene.remove(krq21, krq22, krq23, krq24);
        scene.remove(krq25, krq26, krq27, krq28);
      }
    },
    function () {
      $("#tanchuangshow").style.display = "none";
      $("#namechangge0").innerHTML = "E层监测项";
      $("#namechangge1").innerHTML = "E1";
      $("#namechangge2").innerHTML = "E2";
      $("#namechangge3").innerHTML = "E3";
      $("#namechangge4").innerHTML = "E4";
      oIndexDivA.innerHTML = strbox[4];
      if (rsqState[4] == 1) {
        scene.children[2].children[0].visible = false;
        scene.children[2].children[10].visible = false;
        scene.children[2].children[18].visible = false;
        scene.children[2].children[26].visible = false;
        scene.children[2].children[6].visible = false;
        scene.children[2].children[16].visible = false;
        scene.children[2].children[24].visible = false;
        scene.children[2].children[32].visible = false;

        scene.children[2].children[5].visible = false;
        scene.children[2].children[15].visible = false;
        scene.children[2].children[23].visible = false;
        scene.children[2].children[31].visible = false;

        scene.children[2].children[4].visible = false;
        scene.children[2].children[14].visible = false;
        scene.children[2].children[22].visible = false;
        scene.children[2].children[30].visible = false;

        scene.children[2].children[3].visible = false;
        scene.children[2].children[13].visible = false;
        scene.children[2].children[21].visible = false;
        scene.children[2].children[29].visible = false;

        scene.children[2].children[2].visible = true;
        scene.children[2].children[12].visible = true;
        scene.children[2].children[20].visible = true;
        scene.children[2].children[28].visible = true;

        scene.children[2].children[1].visible = false;
        scene.children[2].children[11].visible = false;
        scene.children[2].children[19].visible = false;
        scene.children[2].children[27].visible = false;

        scene.children[2].children[7].visible = false;
        scene.children[2].children[17].visible = false;
        scene.children[2].children[25].visible = false;
        scene.children[2].children[33].visible = false;

        scene.remove(krq1, krq2, krq3, krq4);
        scene.remove(krq5, krq6, krq7, krq8);
        scene.remove(krq9, krq10, krq11, krq12);
        scene.remove(krq13, krq14, krq15, krq16);
        scene.remove(krq17, krq18, krq19, krq20);
        scene.remove(krq21, krq22, krq23, krq24);
        scene.remove(krq25, krq26, krq27, krq28);
      } else {
        scene.children[2].children[0].visible = false;
        scene.children[2].children[10].visible = false;
        scene.children[2].children[18].visible = false;
        scene.children[2].children[26].visible = false;
        scene.children[2].children[6].visible = false;
        scene.children[2].children[16].visible = false;
        scene.children[2].children[24].visible = false;
        scene.children[2].children[32].visible = false;

        scene.children[2].children[5].visible = false;
        scene.children[2].children[15].visible = false;
        scene.children[2].children[23].visible = false;
        scene.children[2].children[31].visible = false;

        scene.children[2].children[4].visible = false;
        scene.children[2].children[14].visible = false;
        scene.children[2].children[22].visible = false;
        scene.children[2].children[30].visible = false;

        scene.children[2].children[3].visible = false;
        scene.children[2].children[13].visible = false;
        scene.children[2].children[21].visible = false;
        scene.children[2].children[29].visible = false;

        scene.children[2].children[2].visible = true;
        scene.children[2].children[12].visible = true;
        scene.children[2].children[20].visible = true;
        scene.children[2].children[28].visible = true;

        scene.children[2].children[1].visible = false;
        scene.children[2].children[11].visible = false;
        scene.children[2].children[19].visible = false;
        scene.children[2].children[27].visible = false;

        scene.children[2].children[7].visible = false;
        scene.children[2].children[17].visible = false;
        scene.children[2].children[25].visible = false;
        scene.children[2].children[33].visible = false;

        scene.remove(krq1, krq2, krq3, krq4);
        scene.remove(krq5, krq6, krq7, krq8);
        scene.remove(krq9, krq10, krq11, krq12);
        scene.remove(krq13, krq14, krq15, krq16);
        scene.add(krq17, krq18, krq19, krq20);
        scene.remove(krq21, krq22, krq23, krq24);
        scene.remove(krq25, krq26, krq27, krq28);
      }
    },
    function () {
      $("#tanchuangshow").style.display = "none";
      $("#namechangge0").innerHTML = "F层监测项";
      $("#namechangge1").innerHTML = "F1";
      $("#namechangge2").innerHTML = "F2";
      $("#namechangge3").innerHTML = "F3";
      $("#namechangge4").innerHTML = "F4";
      oIndexDivA.innerHTML = strbox[5];
      if (rsqState[5] == 1) {
        scene.children[2].children[0].visible = false;
        scene.children[2].children[10].visible = false;
        scene.children[2].children[18].visible = false;
        scene.children[2].children[26].visible = false;
        scene.children[2].children[6].visible = false;
        scene.children[2].children[16].visible = false;
        scene.children[2].children[24].visible = false;
        scene.children[2].children[32].visible = false;

        scene.children[2].children[5].visible = false;
        scene.children[2].children[15].visible = false;
        scene.children[2].children[23].visible = false;
        scene.children[2].children[31].visible = false;

        scene.children[2].children[4].visible = false;
        scene.children[2].children[14].visible = false;
        scene.children[2].children[22].visible = false;
        scene.children[2].children[30].visible = false;

        scene.children[2].children[3].visible = false;
        scene.children[2].children[13].visible = false;
        scene.children[2].children[21].visible = false;
        scene.children[2].children[29].visible = false;

        scene.children[2].children[2].visible = false;
        scene.children[2].children[12].visible = false;
        scene.children[2].children[20].visible = false;
        scene.children[2].children[28].visible = false;

        scene.children[2].children[1].visible = true;
        scene.children[2].children[11].visible = true;
        scene.children[2].children[19].visible = true;
        scene.children[2].children[27].visible = true;

        scene.children[2].children[7].visible = false;
        scene.children[2].children[17].visible = false;
        scene.children[2].children[25].visible = false;
        scene.children[2].children[33].visible = false;

        scene.children[2].children[0].visible = false;
        scene.children[2].children[10].visible = false;
        scene.children[2].children[18].visible = false;
        scene.children[2].children[26].visible = false;

        scene.remove(krq1, krq2, krq3, krq4);
        scene.remove(krq5, krq6, krq7, krq8);
        scene.remove(krq9, krq10, krq11, krq12);
        scene.remove(krq13, krq14, krq15, krq16);
        scene.remove(krq17, krq18, krq19, krq20);
        scene.remove(krq21, krq22, krq23, krq24);
        scene.remove(krq25, krq26, krq27, krq28);
      } else {
        scene.children[2].children[0].visible = false;
        scene.children[2].children[10].visible = false;
        scene.children[2].children[18].visible = false;
        scene.children[2].children[26].visible = false;
        scene.children[2].children[6].visible = false;
        scene.children[2].children[16].visible = false;
        scene.children[2].children[24].visible = false;
        scene.children[2].children[32].visible = false;

        scene.children[2].children[5].visible = false;
        scene.children[2].children[15].visible = false;
        scene.children[2].children[23].visible = false;
        scene.children[2].children[31].visible = false;

        scene.children[2].children[4].visible = false;
        scene.children[2].children[14].visible = false;
        scene.children[2].children[22].visible = false;
        scene.children[2].children[30].visible = false;

        scene.children[2].children[3].visible = false;
        scene.children[2].children[13].visible = false;
        scene.children[2].children[21].visible = false;
        scene.children[2].children[29].visible = false;

        scene.children[2].children[2].visible = false;
        scene.children[2].children[12].visible = false;
        scene.children[2].children[20].visible = false;
        scene.children[2].children[28].visible = false;

        scene.children[2].children[1].visible = true;
        scene.children[2].children[11].visible = true;
        scene.children[2].children[19].visible = true;
        scene.children[2].children[27].visible = true;

        scene.children[2].children[7].visible = false;
        scene.children[2].children[17].visible = false;
        scene.children[2].children[25].visible = false;
        scene.children[2].children[33].visible = false;

        scene.remove(krq1, krq2, krq3, krq4);
        scene.remove(krq5, krq6, krq7, krq8);
        scene.remove(krq9, krq10, krq11, krq12);
        scene.remove(krq13, krq14, krq15, krq16);
        scene.remove(krq17, krq18, krq19, krq20);
        scene.add(krq21, krq22, krq23, krq24);
        scene.remove(krq25, krq26, krq27, krq28);
      }
    },
    function () {
      $("#tanchuangshow").style.display = "none";
      $("#namechangge0").innerHTML = "G层监测项";
      $("#namechangge1").innerHTML = "G1";
      $("#namechangge2").innerHTML = "G2";
      $("#namechangge3").innerHTML = "G3";
      $("#namechangge4").innerHTML = "G4";
      oIndexDivA.innerHTML = strbox[6];
      if (rsqState[6] == 1) {
        scene.children[2].children[0].visible = false;
        scene.children[2].children[10].visible = false;
        scene.children[2].children[18].visible = false;
        scene.children[2].children[26].visible = false;
        scene.children[2].children[6].visible = false;
        scene.children[2].children[16].visible = false;
        scene.children[2].children[24].visible = false;
        scene.children[2].children[32].visible = false;

        scene.children[2].children[5].visible = false;
        scene.children[2].children[15].visible = false;
        scene.children[2].children[23].visible = false;
        scene.children[2].children[31].visible = false;

        scene.children[2].children[4].visible = false;
        scene.children[2].children[14].visible = false;
        scene.children[2].children[22].visible = false;
        scene.children[2].children[30].visible = false;

        scene.children[2].children[3].visible = false;
        scene.children[2].children[13].visible = false;
        scene.children[2].children[21].visible = false;
        scene.children[2].children[29].visible = false;

        scene.children[2].children[2].visible = false;
        scene.children[2].children[12].visible = false;
        scene.children[2].children[20].visible = false;
        scene.children[2].children[28].visible = false;

        scene.children[2].children[1].visible = false;
        scene.children[2].children[11].visible = false;
        scene.children[2].children[19].visible = false;
        scene.children[2].children[27].visible = false;

        scene.children[2].children[7].visible = true;
        scene.children[2].children[17].visible = true;
        scene.children[2].children[25].visible = true;
        scene.children[2].children[33].visible = true;

        scene.remove(krq1, krq2, krq3, krq4);
        scene.remove(krq5, krq6, krq7, krq8);
        scene.remove(krq9, krq10, krq11, krq12);
        scene.remove(krq13, krq14, krq15, krq16);
        scene.remove(krq17, krq18, krq19, krq20);
        scene.remove(krq21, krq22, krq23, krq24);
        scene.remove(krq25, krq26, krq27, krq28);
      } else {
        scene.children[2].children[0].visible = false;
        scene.children[2].children[10].visible = false;
        scene.children[2].children[18].visible = false;
        scene.children[2].children[26].visible = false;
        scene.children[2].children[6].visible = false;
        scene.children[2].children[16].visible = false;
        scene.children[2].children[24].visible = false;
        scene.children[2].children[32].visible = false;

        scene.children[2].children[5].visible = false;
        scene.children[2].children[15].visible = false;
        scene.children[2].children[23].visible = false;
        scene.children[2].children[31].visible = false;

        scene.children[2].children[4].visible = false;
        scene.children[2].children[14].visible = false;
        scene.children[2].children[22].visible = false;
        scene.children[2].children[30].visible = false;

        scene.children[2].children[3].visible = false;
        scene.children[2].children[13].visible = false;
        scene.children[2].children[21].visible = false;
        scene.children[2].children[29].visible = false;

        scene.children[2].children[2].visible = false;
        scene.children[2].children[12].visible = false;
        scene.children[2].children[20].visible = false;
        scene.children[2].children[28].visible = false;

        scene.children[2].children[1].visible = false;
        scene.children[2].children[11].visible = false;
        scene.children[2].children[19].visible = false;
        scene.children[2].children[27].visible = false;

        scene.children[2].children[7].visible = true;
        scene.children[2].children[17].visible = true;
        scene.children[2].children[25].visible = true;
        scene.children[2].children[33].visible = true;

        scene.remove(krq1, krq2, krq3, krq4);
        scene.remove(krq5, krq6, krq7, krq8);
        scene.remove(krq9, krq10, krq11, krq12);
        scene.remove(krq13, krq14, krq15, krq16);
        scene.remove(krq17, krq18, krq19, krq20);
        scene.remove(krq21, krq22, krq23, krq24);
        scene.add(krq25, krq26, krq27, krq28);
      }
    },
    function () {
      $("#tanchuangshow").style.display = "none";
      $("#namechangge0").innerHTML = "SOFA层监测项";
      $("#namechangge1").innerHTML = "SOFA1";
      $("#namechangge2").innerHTML = "SOFA2";
      $("#namechangge3").innerHTML = "SOFA3";
      $("#namechangge4").innerHTML = "SOFA4";
      oIndexDivA.innerHTML = sofastrbox[0];

      scene.children[2].children[0].visible = true;
      scene.children[2].children[10].visible = true;
      scene.children[2].children[18].visible = true;
      scene.children[2].children[26].visible = true;

      scene.children[2].children[6].visible = false;
      scene.children[2].children[16].visible = false;
      scene.children[2].children[24].visible = false;
      scene.children[2].children[32].visible = false;

      scene.children[2].children[5].visible = false;
      scene.children[2].children[15].visible = false;
      scene.children[2].children[23].visible = false;
      scene.children[2].children[31].visible = false;

      scene.children[2].children[4].visible = false;
      scene.children[2].children[14].visible = false;
      scene.children[2].children[22].visible = false;
      scene.children[2].children[30].visible = false;

      scene.children[2].children[3].visible = false;
      scene.children[2].children[13].visible = false;
      scene.children[2].children[21].visible = false;
      scene.children[2].children[29].visible = false;

      scene.children[2].children[2].visible = false;
      scene.children[2].children[12].visible = false;
      scene.children[2].children[20].visible = false;
      scene.children[2].children[28].visible = false;

      scene.children[2].children[1].visible = false;
      scene.children[2].children[11].visible = false;
      scene.children[2].children[19].visible = false;
      scene.children[2].children[27].visible = false;

      scene.children[2].children[7].visible = false;
      scene.children[2].children[17].visible = false;
      scene.children[2].children[25].visible = false;
      scene.children[2].children[33].visible = false;

      scene.remove(krq1, krq2, krq3, krq4);
      scene.remove(krq5, krq6, krq7, krq8);
      scene.remove(krq9, krq10, krq11, krq12);
      scene.remove(krq13, krq14, krq15, krq16);
      scene.remove(krq17, krq18, krq19, krq20);
      scene.remove(krq21, krq22, krq23, krq24);
      scene.remove(krq25, krq26, krq27, krq28);
    },
  ];
  let currentMethodIndex = 0;
  function manyou() {
    if (currentMethodIndex > 7) {
      currentMethodIndex = 0;
    }
    initDataFromINnput();
    // getData()
    methods[currentMethodIndex]();
    setTimeout(() => {
      $("#tanchuangshow").style.display = "block";
    }, 3000);
    currentMethodIndex++;
  }
  setInterval(manyou, 18000);
  // let c_form = eval('formview_' + now_open_diag.fmname)
  // c_form.onready = function () { // 页面打开 数据加载完成
  //     // initDataFromINnput()
  //     get3DFloorColor()
  // }
  // lsLoader('加载中....')
  setTimeout(() => {
    get3DFloorColor();
    // getData()
    initDataFromINnput();
    manyou();
  }, 500);
  let oTodayTimer = setInterval(() => {
    document.getElementById("todayTimer").innerHTML = moment(new Date()).format(
      "YYYY-MM-DD HH:mm:ss"
    );
  }, 1000);
})();
